【发布时间】:2015-05-15 17:54:53
【问题描述】:
我有多个 Elasticsearch 1.3.2 索引,并且我正在使用自定义文档 ID。我想在我的索引中找到不同 ID 的数量。有些文档具有相同的 ID,但在不同的索引中,因此这与仅计算文档不同。所以我想对 _id 字段进行基数聚合。所以我把这个发到http://localhost:9200/*my_indices*/_search:
{ "from": 0, "size": 0, "aggregations": { "_count": { "cardinality": { "script": "doc['_id'].value", "lang": "groovy" } } } }
但是 Elasticsearch 刚刚发回了这个:
{ "took": 60, "timed_out": false, "_shards": { "total": 175, "successful": 175, "failed": 0 }, "hits": { "total": 310714, "max_score": 0, "hits": [] }, "aggregations": { "_count": { "value": 0 } }
我很确定那里有超过 0 个 ID!发生了什么,有没有可能得到我想要的?
【问题讨论】:
标签: groovy elasticsearch