Rarest term filter

Hi all,

would there be a way to filter matches to a query in such a way that only matches are accepted where (at least) the rarest term in the result occurs in the query.

worded differently: there cannot be any unmatched terms in the result that are rarer than the matching terms.

By rare I mean terms contained in the least amount of documents.

example:

index containing

- foo corp
- bar corp

if I query
spam corp
I want 0 matched: both foo corp and bar corp share the word corp with the query, but they both contain a term that is rarer than corp, so they should be filtered out.

if I query
bar inc
I want bar corp as a match, because bar is the rarest term in the result, and it is matched to the query.

I basically want results that match on their most "unique" part.
I don't immediately see a way to achieve this with scripts.

Kind regards

1 Like

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