Reputation: 43
I hava a problem with es query and aggregation. All es record count is about 0.1 billion, before adding a terms aggregation, my query is fast, only cost 75ms and all hit count is 105. But after adding a aggregation, like this one:
{
"query": {
...
},
"aggs": {
"index": {
"terms": {
"field": "index"
}
}
}
}
this query will cost 20 second! My question is: my query result count is only 105, why the aggregation is so slow? Thanks for any reply!
Upvotes: 0
Views: 486
Reputation: 532
From what I have understood from your question, I think this is what you need:
{
"query": {
...
},
"aggs": {
"index": {
"terms": {
"field": "index",
"execution_hint": "map"
}
}
}
}
Try this and let me know. Explanation for execution_hint
and discussion helped to tackle your problem can be found here and here.
Upvotes: 4