# Proximity with Boolean operators?

**URL:** <https://discuss.elastic.co/t/proximity-with-boolean-operators/318083>\
**Category:** Elasticsearch\
**Created:** [November 3, 2022, 9:08am UTC](https://discuss.elastic.co/t/proximity-with-boolean-operators/318083 "2022-11-03T09:08:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Broccolimon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/broccolimon/32/112889_2.png) [@Broccolimon](https://discuss.elastic.co/u/Broccolimon)\
**Post date:** [November 3, 2022, 9:08am UTC](https://discuss.elastic.co/t/proximity-with-boolean-operators/318083/1 "2022-11-03T09:08:46Z")

</div>

I would like to run queries with the format:

```auto
  query = {
      "size": limit,
      "query": {
          "query_string": {"query": query,
                           "default_operator":"AND"}
      }
  }

```

Where my query is using both proximity search and boolean of "not":

query: "quick brown -fox"~5

So all results must contain "quick" , "brown" and not "fox" , and all rules should apply for the 5 edit distance words, such that fox can be in the text but it must be more than 5 words from any other keywords (brown and quick)

and idea how to do it?

---

<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:** [December 1, 2022, 9:09am UTC](https://discuss.elastic.co/t/proximity-with-boolean-operators/318083/2 "2022-12-01T09:09:31Z")

</div>

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