WordDelimiter in combination with cross_fields

Hi there,

I have a search-query which uses a cross_fields multi_match to look for the searched terms in multiple fields.

The query also contains a word_delimiter on both the searched terms and the terms in the documents. This is to match HP21 to HP 21 and to HP-21.

However I ran into the issue that HP21 will also match a HP 38 with 21% VAT hidden somewhere in another field. This is not desirable.

What I would like:
I would like a way to make the terms that are split by the word-delimiter only match when the found results are in the same field, and preferably next to each other. I still want to match cross fields for all other terms.

Example:

Document1
{ 'field1': "HP 21", 'field2': "Blue" }

Document2
{ 'field1': "HP 38", 'field2': "blue 21% VAT" }

Search term "HP-21 blue".

It should match document 1, because the word delimiter splits HP-21 to HP 21 and those are in proximity to eachother. Blue is in another field, but still matches.

It shouldn't match document 2 because HP-21 is split to HP 21, but 21 is in another field.

Thanks in advance,

Patrick

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