愚者求师之过,智者从师之长。

用highlevel client aggregation 返回数据不对(超时?)

Elasticsearch | 作者 aiolos | 发布于2021年02月08日 | 阅读数:1603

现在发现好像是超时的原因,took<1000的就能正常返回,took>1000的就会_shards.successful
------------------------2021-02-24,下面是之前提问的内容-------------------------------------
 用highlevel  client执行聚合查询,偶发性的结果错误。
感谢各位帮忙看下原因
我用highlevel client 执行聚合查询,searchbuilder 打印如下(省略了query 部分):
{
"size": 0,
"query": {},
"aggregations": {
"term0": {
"filter": {
"match_all": {
"boost": 1
}
},
"aggregations": {
"countCOUNT_DISTINCTdid": {
"cardinality": {
"field": "did",
"precision_threshold": 40000
}
}
}
}
}
}
然后执行,错误结果如下:
{
"took": 1002,
"timed_out": false,
"terminated_early": false,
"num_reduce_phases": 0,
"_shards": {
"total": 20,
"successful": 0,
"skipped": 0,
"failed": 0
},
"hits": {
"total": {
"value": 0,
"relation": "gte"
},
"max_score": null,
"hits":
}
}
在kibana执行就能正常获取结果:
{
  "took" : 231,
  "timed_out" : false,
  "_shards" : {
    "total" : 20,
    "successful" : 20,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "aggregations" : {
    "term0" : {
      "doc_count" : 8526098,
      "countCOUNT_DISTINCTdid" : {
        "value" : 3929368
      }
    }
  }
}
请大佬帮忙看下原因
已邀请:

要回复问题请先登录注册