Best way to implement terms query for analyzed field

Hi,
I have a document that contains a text field with a hierarchy path

  • doc {
    • path: "some/long/path/to/file.txt"
      }

now, my requirements are that I will be able to query all the documents that their path field ends with < some path >.

for example, I want to supply a list of partial paths (to be more exact, suffixes of paths), and I want to get all the documents that their path ends with one of the suffixes.

If I should have search an exact matches, it looks like at terms query would fit, but from what I have read, it's only for not analyzed fields, and in my case, I don't see a way out or analyzing the path.

I have read about path hierarchy analyzer , and it looks like it can help by using "reverse" property of the tokenizer.. but it's still not solve the "terms" query requirements
(it's crucial for us to query all documents in one bulk, because there could be a lot, so a loop is not an option here..

and suggestion for this scenario?

Thanks

update -
it looks like terms query does work with analyzed field.
used path_hierarchy tokenizer + reverse mode and it seems to work.

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