Not able to query across tree structure with millions of links

try

query {
	var(func: eq(Parameter.key, "someKey"))  {
		Parameter.inBuckets {
			Bucket.inFiles {
				files as uid
			}
		}
	}
  
	query(func: uid(files)) {
		count(uid)
	}
}