【发布时间】:2014-12-26 16:25:30
【问题描述】:
ES 1.4.2 Value Count 聚合返回的值不正确。
当我运行以下查询以获取“持续时间”字段中数组元素的总数时,value_count 聚合器正在获取唯一值的计数。
查询:
{
"query": {
"filtered": {
"query": {
"match": {
"sessions.applicationId": {
"query": 208,
"type": "boolean"
}
}
},
"filter": {
"and": {
"filters": [
{
"range": {
"eventDate": {
"from": 1388916360000,
"to": 1389402273384,
"include_lower": true,
"include_upper": true
}
}
}
]
}
}
}
},
"aggregations": {
"Session_Count": {
"value_count": {
"field": "durations"
}
}
}
}
结果命中
"hits": [
{
"_index": "users",
"_type": "sessions",
"_id": "18967_20140105_CF538C86DEBC432DBDE40887FE6CA051",
"_score": 1,
"_source": {
"eventDate": "2014-01-05T17:01:18",
"manufacturer": "apple",
"applicationId": "208",
"durations": [
2,
2
]
}
},
{
"_index": "users",
"_type": "sessions",
"_id": "2386_20140109_5AC476D2FC784826A3B3A6584578597E",
"_score": 1,
"_source": {
"eventDate": "2014-01-09T15:55:53",
"manufacturer": "apple",
"applicationId": "208",
"durations": [
1,
1
]
}
]
"aggregations": {
"Session_Count": {
"value": 2
}
}
在“持续时间”数组 [2,2] 和 [1,1] 的 value_count 的上述结果中,结果为 2。我期望它为 4,如 ES 参考文档中给出的那样。
对于不同的值,例如持续时间 [1,2],[3],[3,2,4] 的值是正确的,它是 6。
这是 Elastic Search Value_count 功能的问题还是我在这里遗漏了什么。
谁能告诉我这个。
【问题讨论】:
标签: elasticsearch