Path_hierarchy aggregation for specific depth


I'm using the path_hierarchy tokenizer to index file system paths and it works perfectly for querying. However, I'm also interested in finding all possible paths for a certain depth.

My approach so far has been to use an aggregation with a filter:

{"terms": {"field": "path",
                  "include" "/[^/]+"}}

This would give me everything directly under / but using a regex is too slow with the index I'm using. Is there a way to solve this with the path_hierarchy tokenizer that I'm missing, or can someone point me in another direction?

(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.