# Can word spacing support and or relationship

**URL:** <https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444>\
**Category:** Elasticsearch\
**Created:** [May 24, 2022, 3:16am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444 "2022-05-24T03:16:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-Dragon0302](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s-dragon0302/32/100509_2.png) [@S-Dragon0302](https://discuss.elastic.co/u/S-Dragon0302)\
**Post date:** [May 24, 2022, 3:16am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/1 "2022-05-24T03:16:54Z")

</div>

query\_string case:  
((a|b)+(c|d))~10 ==\> ((a+c)~10)|((a+d)~10)|((b+c)~10)|((b+d)~10)  
Can this be true,What should I do if I want to do this.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 24, 2022, 3:37am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/2 "2022-05-24T03:37:59Z")

</div>

Can you clarify what you mean here, it's not clear what this has to do with a `query_string` query.

---

<div class="post-metadata">

**Author:** ![S-Dragon0302](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s-dragon0302/32/100509_2.png) [@S-Dragon0302](https://discuss.elastic.co/u/S-Dragon0302)\
**Post date:** [May 24, 2022, 6:17am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/3 "2022-05-24T06:17:11Z")

</div>

"query": " +(+(keys:"a" keys:"b") +(keys:"c" keys:"d"))~10", Word spacing does not take effect。

---

<div class="post-metadata">

**Author:** ![S-Dragon0302](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s-dragon0302/32/100509_2.png) [@S-Dragon0302](https://discuss.elastic.co/u/S-Dragon0302)\
**Post date:** [May 24, 2022, 6:20am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/4 "2022-05-24T06:20:36Z")

</div>

I want C or D to appear at the same time as a, so that the word spacing of a and C is 10, or the word spacing of a and D is 10. query\_string How to achieve this.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [May 24, 2022, 6:36am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/5 "2022-05-24T06:36:55Z")

</div>

Hi. Span or interval queries support this but require JSON syntax.

---

<div class="post-metadata">

**Author:** ![S-Dragon0302](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s-dragon0302/32/100509_2.png) [@S-Dragon0302](https://discuss.elastic.co/u/S-Dragon0302)\
**Post date:** [May 24, 2022, 7:00am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/6 "2022-05-24T07:00:17Z")

</div>

(a|b|c|d|e|f|g|h|i|j)+(A|B|C|D|E|F|G|H|I|J)+(Aa|Bb|Cc|Dc|Ee|Ff|Gg|Hh|Ii|Jj)  
Combination number is 1000,Using span or interval, the generated statement is too long and the execution consumes too much CPU

---

<div class="post-metadata">

**Author:** ![S-Dragon0302](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s-dragon0302/32/100509_2.png) [@S-Dragon0302](https://discuss.elastic.co/u/S-Dragon0302)\
**Post date:** [May 24, 2022, 7:02am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/7 "2022-05-24T07:02:39Z")

</div>

I hope this part of the work is implemented by the query parser

---

<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:** [June 21, 2022, 7:02am UTC](https://discuss.elastic.co/t/can-word-spacing-support-and-or-relationship/305444/8 "2022-06-21T07:02:52Z")

</div>

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