# And of array items in terms query

**URL:** <https://discuss.elastic.co/t/and-of-array-items-in-terms-query/319633>\
**Category:** Elasticsearch\
**Created:** [November 23, 2022, 9:07am UTC](https://discuss.elastic.co/t/and-of-array-items-in-terms-query/319633 "2022-11-23T09:07:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chirag\_bansal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chirag_bansal/32/105065_2.png) [@chirag\_bansal](https://discuss.elastic.co/u/chirag_bansal)\
**Post date:** [November 23, 2022, 9:07am UTC](https://discuss.elastic.co/t/and-of-array-items-in-terms-query/319633/1 "2022-11-23T09:07:17Z")

</div>

Hi, I need to know that whether an AND functionality of terms query exists or not?  
For example -

```auto
{
  "terms": {
     "color": [
        blue, 
        red, 
        black
     ]
  }
}

```

The above query will return all the documents having any of the three colors but I want only those documents having all the three colors.  
I already know a way to combine boolean and match query but is there any way where I can pass the whole array like terms query to get the desired result.  
Thankyou!

---

<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 21, 2022, 9:08am UTC](https://discuss.elastic.co/t/and-of-array-items-in-terms-query/319633/2 "2022-12-21T09:08:03Z")

</div>

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