# Search for documents containing an item not present in a list

**URL:** <https://discuss.elastic.co/t/search-for-documents-containing-an-item-not-present-in-a-list/314958>\
**Category:** Elasticsearch\
**Created:** [September 22, 2022, 2:38pm UTC](https://discuss.elastic.co/t/search-for-documents-containing-an-item-not-present-in-a-list/314958 "2022-09-22T14:38:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [September 22, 2022, 6:07pm UTC](https://discuss.elastic.co/t/search-for-documents-containing-an-item-not-present-in-a-list/314958/2 "2022-09-22T18:07:22Z")

</div>

Hi @Adrian_Fresco

I adapted the query by this [post](https://discuss.elastic.co/t/elastic-search-query-that-matches-all-elements-in-nested-document/307395/4). Try please.

```auto
{
  "query": {
    "bool": {
      "must": [
        {
          "nested": {
            "path": "fruits",
            "query": {
              "bool": {
                "must_not": [
                  {
                    "terms": {
                      "fruits.name": [
                        "apple",
                        "pineapple",
                        "grape",
                        "orange",
                        "pear"
                      ]
                    }
                  }
                ]
              }
            }
          }
        }
      ]
    }
  }
}

```

---

_[View the full topic](https://discuss.elastic.co/t/search-for-documents-containing-an-item-not-present-in-a-list/314958)._
