elasticsearch 加总错误
我正在尝试运行此查询:elasticsearch 加总错误,elasticsearch,elasticsearch,我正在尝试运行此查询: GET my_index/_search { "size": 0, "query": { "bool": { "filter": [ { "query_string": { "query": "_exists_:products_count", "default_operator": "AND" } } ]
GET my_index/_search
{
"size": 0,
"query": {
"bool": {
"filter": [
{
"query_string": {
"query": "_exists_:products_count",
"default_operator": "AND"
}
}
]
}
},
"aggs": {
"pid": {
"terms": {
"field": "pid",
"size": 15,
"order": {
"products_counter": "ASC"
}
},
"aggs": {
"products_counter": {
"sum": {
"field": "products_count"
}
}
}
}
}
}
我得到的结果是:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 12,
"successful": 12,
"failed": 0
},
"hits": {
"total": 489681,
"max_score": 0,
"hits": []
},
"aggregations": {
"pid": {
"doc_count_error_upper_bound": -1,
"sum_other_doc_count": 488443,
"buckets": [
{
"key": 3229479298,
"doc_count": 14,
"products_counter": {
"value": 26
}
},
{...
虽然返回的pid结果是188,而不是26。
例如,如果我将聚合的大小从15提高到100000,我确实得到了正确的数字。
理解和解决我的问题有什么帮助吗?这应该可以解释你看到的问题:@Val嗨,我只使用了一个碎片:/e我在你的ES响应中看到12个碎片。是的,通过像你那样增加大小。请注意,如果你没有太多文档,一个碎片就足够了。