I'm trying to tun a terms query and filter with the results on some aggrs I run. It looks like this:
{
"aggregations": {
"aggs_name": {
"aggregations": {
...
},
"filter": {
"bool": {
"filter": [
{
"terms": {
"node_type": [
"type_a",
"type_b"
]
}
},
{
"terms": {
"some_field": {
"id": "HUGE_DOC",
"index": "lables",
"path": "field_name",
"type": "_doc"
}
}
}
]
}
}
}
},
"query": {
...
},
"size": 0
}
The HUGE_DOC
contains a filed with something like 15k ip address which I need to filter by.
Trying to run this query raises:
{
"error" : {
"root_cause" : [
{
"type" : "too_many_clauses",
"reason" : "maxClauseCount is set to 1024"
}
],
"type" : "search_phase_execution_exception",
"reason" : "all shards failed",
"phase" : "query",
"grouped" : true,
"failed_shards" : [
{
"shard" : 0,
"index" : "index_name ",
"node" : "eX4_hQltQZWZ013rCm8MSA",
"reason" : {
"type" : "too_many_clauses",
"reason" : "maxClauseCount is set to 1024"
}
}
],
"caused_by" : {
"type" : "too_many_clauses",
"reason" : "maxClauseCount is set to 1024",
"caused_by" : {
"type" : "too_many_clauses",
"reason" : "maxClauseCount is set to 1024"
}
}
},
"status" : 500
}
What can I do in order to filter on a terms query with big amount of values?