# No support for distance between a term and an exact term with slop

**URL:** <https://discuss.elastic.co/t/no-support-for-distance-between-a-term-and-an-exact-term-with-slop/311309>\
**Category:** Elasticsearch\
**Created:** [August 3, 2022, 12:47pm UTC](https://discuss.elastic.co/t/no-support-for-distance-between-a-term-and-an-exact-term-with-slop/311309 "2022-08-03T12:47:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Savi\_Ifraimov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/savi_ifraimov/32/98588_2.png) [@Savi\_Ifraimov](https://discuss.elastic.co/u/Savi_Ifraimov)\
**Post date:** [August 3, 2022, 12:47pm UTC](https://discuss.elastic.co/t/no-support-for-distance-between-a-term-and-an-exact-term-with-slop/311309/1 "2022-08-03T12:47:00Z")

</div>

Hello,  
I am trying to use the 'simple query string query' (as well as other query options) to give me certain results and wonder about my options / if it is possible.

The challenge: to search for a term1 within distance of X from term2 (with term2 being a phrase with multiple words).  
So, for example: plate "home center store" ~6. It should return me hits like "in home center store, my favorite plate can be found",  
whereas "in home center store, there are a lot of new products including my favorite plate" will not be found.

- My attempt: wrote inside simple\_query\_string\_query's query:  
"\"plate \"home center\"\"~1"

I have read most of the relevant docs but have not found an answer (perhaps you can enlighten me). If 'query string query' or any other syntax allows such option, please let me know.  
Any syntaxis option will do it.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [August 3, 2022, 1:52pm UTC](https://discuss.elastic.co/t/no-support-for-distance-between-a-term-and-an-exact-term-with-slop/311309/2 "2022-08-03T13:52:40Z")

</div>

Hi @Savi_Ifraimov

Have you read about [Interval Query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-intervals-query.html)? Maybe I can help you.

---

<div class="post-metadata">

**Author:** ![Savi\_Ifraimov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/savi_ifraimov/32/98588_2.png) [@Savi\_Ifraimov](https://discuss.elastic.co/u/Savi_Ifraimov)\
**Post date:** [August 4, 2022, 6:16am UTC](https://discuss.elastic.co/t/no-support-for-distance-between-a-term-and-an-exact-term-with-slop/311309/3 "2022-08-04T06:16:59Z")

</div>

@RabBit_BR  
It did help.  
Follow-up question: can you "embed" interval query inside a 'simple query string' or you basically can't use both together?

---

<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:** [September 1, 2022, 6:17am UTC](https://discuss.elastic.co/t/no-support-for-distance-between-a-term-and-an-exact-term-with-slop/311309/4 "2022-09-01T06:17:57Z")

</div>

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