Match each token just once against each clause

Hi,

I have a query that contains 2 different clauses. One for term query and one for prefix query. I want to know if there's a way for each of the tokens of the match field in the document I'm searching, to match just once against each of the clauses.

For example if I have a document that has a match field containing: "mary smith" and I'm searching for the name "mary m smith" both the term query and the prefix query would match against "mary". I need to find a way to match each token of the name I sent with a different token of the name in the document. In the example there shouldn't be a match because "mary" and "smith" found" a match but "m" didn't because the only possible match being a prefix was "mary" but this token already had a match.

Thanks and regards,

Maybe it helps to explain your use-case completely without any technology terminology (imagine no elasticsearch, no match query, no prefix query, just a search term and documents). From a use-case perspective, what do you want to achieve here?

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