We have indexed a lot of urls, and for each url we also have title and a metric. We need to perform a query aggregation over url and title.keyword and sum of metric and take the top 10 sof those buckets.
The aggs portion of our query is the following:
"aggs": {
"by_url_and_title": {
"composite": {
"size": 13000,
"sources": [
{
"final_url": {
"terms": {
"field": "url"
}
}
},
{
"title": {
"terms": {
"field": "title.keyword"
}
}
}
]
},
"aggs": {
"sum_metric": {
"sum": {
"field": "metric"
}
},
"metric_sort": {
"bucket_sort": {
"sort": [
{
"sum_metric": {
"order": "desc"
}
}
],
"size": 10
}
}
}
}
If we move from 1 shard to 2 shard we could have different result.
For the "size" field of this query I posted another question here:
Do you have any suggestions?
Thanks in advance.