如何在ElasticSearch中执行whereIn查询?

My Index looks like this

{name : 'John Doe',group_id : '1'},
{ name : 'Jane Doe', group_id : '2'}
{ name : 'John Doe', group_id : '3'}

and i want to return all indexes that its group_id is in this array [1, 2]

thus it would return:

{name : 'John Doe',group_id : '1'},
{ name : 'Jane Doe', group_id : '2'} 

You can use Terms Query for this. Replace <index> with the name of the index and <type> with the type you want to search on.

POST <index>/<type>/_search
{
   "query": {
      "terms": {
         "group_id": [
            "1",
            "2"
         ]
      }
   }
}