# Need elastic query to fetch list of docs from one index based on list of one type field

**URL:** <https://discuss.elastic.co/t/need-elastic-query-to-fetch-list-of-docs-from-one-index-based-on-list-of-one-type-field/111602>\
**Category:** Elasticsearch\
**Created:** [December 13, 2017, 4:10pm UTC](https://discuss.elastic.co/t/need-elastic-query-to-fetch-list-of-docs-from-one-index-based-on-list-of-one-type-field/111602 "2017-12-13T16:10:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![skodari](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/skodari/32/19875_2.png) [@skodari](https://discuss.elastic.co/u/skodari)\
**Post date:** [December 13, 2017, 4:10pm UTC](https://discuss.elastic.co/t/need-elastic-query-to-fetch-list-of-docs-from-one-index-based-on-list-of-one-type-field/111602/1 "2017-12-13T16:10:46Z")

</div>

Hi Team,

I Need elastic query to fetch list of docs from one index based on list of one type of field(Just like "IN" operator in DB2).

Example:  
GET /my\_country\_index/\_search?size=2000  
{"query": {

```
    "bool":{
      "should/must": [
    { "match" : {"country_cde" : "40"}},
     { "match": {"country_cde" : "44"}},
     { "match": {"country_cde" : "24"}}
    ]
}}} 

```

Instead of this multi match of multi key, values pairs, is there any possibility to pass values with list.

In DB2, .....IN(40, 44,24) query gives the records which were matched, same as I need elastic query with out multi key, value pairs  
because, as i'm a java client for elastic I am passing HashMap for above query so HashMap won't allow duplicate keys.

So I need query with list kind of thing

---

<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:** [January 10, 2018, 4:10pm UTC](https://discuss.elastic.co/t/need-elastic-query-to-fetch-list-of-docs-from-one-index-based-on-list-of-one-type-field/111602/2 "2018-01-10T16:10:55Z")

</div>

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