# Finding multiple exact value

**URL:** <https://discuss.elastic.co/t/finding-multiple-exact-value/168043>\
**Category:** Elasticsearch\
**Created:** [February 12, 2019, 2:06pm UTC](https://discuss.elastic.co/t/finding-multiple-exact-value/168043 "2019-02-12T14:06:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinaWork](https://avatars.discourse-cdn.com/v4/letter/d/edb3f5/32.png) [@dinaWork](https://discuss.elastic.co/u/dinaWork)\
**Post date:** [February 12, 2019, 2:06pm UTC](https://discuss.elastic.co/t/finding-multiple-exact-value/168043/1 "2019-02-12T14:06:49Z")

</div>

I would like to query elastic search , query if field is one of a list  
how do I do that in elastic 6.0.0?  
for example these are my documents:

```auto
{"name" : "jim","company": "a"}
{"name" : "jack","company": "a"}
{"name" : "joe","company": "b"}
{"name" : "foo","company": "b"}
{"name" : "bar","company": "c"}
{"name" : "boe","company": "c"}
{"name" : "jee","company": "d"}

```

Id like to return all entries which have company `a` or `b`

i tried this:

```auto
curl -u elastic:password -XPOST 'localhost:9243/my-index/_search?size=2000&pretty' -H 'Content-Type: application/json' -d'
{
  "size": 2000,
  "query": {
    "bool": {
      "must": [
        {"term": {"company": ["a","b"]}}

      ]
    }
  }
}'

```

but I get an error `[term] query does not support array of values`

note: I need a solution that would let me use an array, since I need to match ~100 options

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 12, 2019, 2:19pm UTC](https://discuss.elastic.co/t/finding-multiple-exact-value/168043/2 "2019-02-12T14:19:45Z")

</div>

You can use a Terms query instead. [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html)

---

<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:** [March 12, 2019, 2:19pm UTC](https://discuss.elastic.co/t/finding-multiple-exact-value/168043/3 "2019-03-12T14:19:49Z")

</div>

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