# Separate query for excluded words

**URL:** <https://discuss.elastic.co/t/separate-query-for-excluded-words/134768>\
**Category:** Elasticsearch\
**Created:** [June 6, 2018, 9:23am UTC](https://discuss.elastic.co/t/separate-query-for-excluded-words/134768 "2018-06-06T09:23:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![newnewb](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@newnewb](https://discuss.elastic.co/u/newnewb)\
**Post date:** [June 6, 2018, 9:23am UTC](https://discuss.elastic.co/t/separate-query-for-excluded-words/134768/1 "2018-06-06T09:23:00Z")

</div>

In the query below I'll exclude all the words that contain "vegetable". Is there a way to create a separate query to get all of the excluded words?

```
{
  "query": {
       "match_phrase": {"words": "get"}
  },
  "aggs": {
    "clusters": {
      "terms": {
        "field": "words",
        "exclude": ".*vegetable.*",

      }
    }
  }
}
```

---

<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 4, 2018, 9:23am UTC](https://discuss.elastic.co/t/separate-query-for-excluded-words/134768/2 "2018-07-04T09:23:03Z")

</div>

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