# WordDelimiter in combination with cross\_fields

**URL:** <https://discuss.elastic.co/t/worddelimiter-in-combination-with-cross-fields/188373>\
**Category:** Elasticsearch\
**Created:** [July 1, 2019, 4:25pm UTC](https://discuss.elastic.co/t/worddelimiter-in-combination-with-cross-fields/188373 "2019-07-01T16:25:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PGoddijn](https://avatars.discourse-cdn.com/v4/letter/p/bc79bd/32.png) [@PGoddijn](https://discuss.elastic.co/u/PGoddijn)\
**Post date:** [July 1, 2019, 4:25pm UTC](https://discuss.elastic.co/t/worddelimiter-in-combination-with-cross-fields/188373/1 "2019-07-01T16:25:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 29, 2019, 4:25pm UTC](https://discuss.elastic.co/t/worddelimiter-in-combination-with-cross-fields/188373/2 "2019-07-29T16:25:46Z")

</div>

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