【发布时间】:2016-01-11 12:19:36
【问题描述】:
我正在尝试在我们的日期存储中获取文档类型的聚合。查看1.7 Type Filter documentation,使用类型过滤器很简单。但是,我在尝试提交该查询时遇到了以下问题:
curl -XGET localhost:9200/my_index/_search?pretty -d '
{ "type":
{ "value" : "my_type" }
}'
结果:
"error" : "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed;...
我已成功运行以下内容:
curl -XGET localhost:9200/my_index/_search?pretty -d '
{
"aggs": {
"type_a_total": {
"filter": {
"type": {
"value": "type_a"
}
}
}
}
}'
curl -XGET localhost:9200/my_index/_search?pretty -d '
{
"aggs": {
"type_b_total": {
"filter": {
"type": {
"value": "type_b"
}
}
}
}
}'
结果:
...
"aggregations" : {
"type_a" : {
"doc_count" : 123456789
}
}
...
"aggregations" : {
"type_b" : {
"doc_count" : 987654321
}
}
...
知道如何在基于_type 的单一聚合中将它们全部取回吗?
【问题讨论】:
标签: elasticsearch elasticsearch-aggregation