我对elasticsearch 2.4上的cardinality
聚合有一个奇怪的结果,
我有10个文件,但是当我这样做时:
GET /test-dev/page_view/_search
{
"size": 0,
"aggs": {
"user_count": {
"cardinality": {
"field": "cookie",
"precision_threshold": 40000
}
}
}
}
结果是:
{
"took": 5,
"timed_out": false,
"_shards": {
"total": 3,
"successful": 3,
"failed": 0
},
"hits": {
"total": 10,
"max_score": 0,
"hits": []
},
"aggregations": {
"user_count": {
"value": 15
}
}
}
它应该是3,是因为我有3个分片和2个副本所以我必须将结果除以5?
答案 0 :(得分:1)
cookie
字段应为"index": "not_analyzed"
,否则该字段将被拆分为令牌,并且不会将其整体保存并与您的Cookie完全匹配。