Match Phrase Suffix option, similar to Match Phrase Prefix?

Hi all,

I'm looking for a solution where I need to match a query phrase against multiple fields, represented below as companyField1, companyField2, and companyField3.

I currently am using the following query in my Java program:
QueryBuilders.multiMatchQuery(companyName, "companyField1", "companyField2", "companyField3").type(MatchQueryBuilder.Type.PHRASE_PREFIX).operator(Operator.AND);

This works very well for company searches like "International Business Machines", "Business Machines", "International Business Mach", but I am also looking for it to match again "national Business Machines". In other words, I'm looking for something like MatchQueryBuilder.Type.PHRASE_PREFIX but instead of PHRASE_PREFIX I would like a PHRASE_SUFFIX field. Is there anything like this possible, since there is no PHRASE_SUFFIX built into elasticsearch?

Thanks,
Todd

The data structures are much more efficient to use in prefix fashion so there isn't a suffix version. There is a reverse token filter but that doesn't really help you here because it only reverses each token and it wouldn't reverse the whole phrase.

I expect you could build a plugin that implemented the right kind of query to be used in combination with the reverse token filter. I guess the question is, how important is this?

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