How to search in full folder path?

I used ElasticSeaarch index filename with full path.

for example, c:\dir11\dir12\dir13\dir14\fn11.txt

What I want to search not just filename, but partial folder are included, for example, "dir13\dir14\fn11.txt".

Would you please give suggestions how to implement? Thanks in advance.

Welcome !

May be this could be helpful?

Thanks David. Will try that and get back later

Looks like pathhierarchy generates term from beginning or the end.

Is it possible to search part of path in the middle, for example, \dir33\dir34?

Would creating a custom tokenizer for the field and split on \ work? That would give you ability to search on path components.

1 Like

Thanks Christian.

I think this may work. But because the search can start and end anywhere, so we should generate all combinations, and it will need a lot of space

If you are looking for partial paths I assume they would be in sequence. Could you maybe use a phrase query?

Do you mean

Will try and get back

Thanks Christian. It works. :slight_smile:

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