Query does not gives result as expected:
when query without using partition the query will return correct result: it will return the max view of all products.
But when partition is used, it won't return the max total view.
get product/_search
{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"cars": {
"terms": {
"field": "type.keyword",
"include": {
"partition": 0,
"num_partitions": 5
},
"order": {
"productHits": "desc"
}
},
"aggs": {
"productHits": {
"sum": {
"field": "hits"
}
}
}
}
}
}
expected:
"buckets" : [
{
"key" : "a car",
"doc_count" : 383,
"productHits" : {
"value" : 209.0
}]
actual:
"buckets" : [
{
"key" : "another car",
"doc_count" : 383,
"productHits" : {
"value" : 9.0
}]
a car has the highest hits of all.