Elastic Search - How to perform IN condition in elastic search
<p>This is how my document looks like in elastic search</p>

<pre><code>{
"entityId": "CAMP_ID",
"txnId": "TXN_ID",
"changeSummary": [{
    "field_name": "status_id",
    "old_val": "1",
    "new_val": "2"
}, {
    "field_name": "budget",
    "old_val": "100",
    "new_val": "250"
}]
}
</code></pre>

<p>I get a list of txnId and list of changeSummary.field_name and I have to get all matching documents. I initially tried this query:</p>

<pre><code>{
 "query" : {
   "bool" : {
     "should" : [ {
    "terms" : {
      "transactionId" : [ "2915315c03b3420280eae04116fb303f" ]
    }
  }, {
    "terms" : {
      "transactionId" : [ "18faf80b3eb44e4b85be993a6d5fd40b" ]
    }
  } ]
}
},
"post_filter" : {
"bool" : {
  "must" : [ {
    "match" : {
      "changeSummary.fieldName" :  "abc" 
    }
    },{
    "match" : {
      "changeSummary.fieldName" :  "xyz" 
    }
  }]
}
}
}
</code></pre>

<p>This works fine but my problem is that list of transactionId can be really huge from 10 to 1000000 (or even more), and if size of list of transactionId is more than 1024 then I start getting </p>

<pre><code>too_many_clauses: maxClauseCount is set to 1024
</code></pre>

<p>Could someone please help in this?</p>