【发布时间】:2017-08-17 00:12:51
【问题描述】:
我使用通配符 (interactive*) 查询索引以获取两个索引 interactive-foo* 和 interactive-bar* 的所有文档。
对于我的一些聚合,所有索引都是相关的,但对于其他聚合只有 interactive-foo* OR interactive-bar*。所以我只想在聚合中过滤这些“子索引”。
GET _search
{
"query":{
"bool": {
"must": [
{
"range": {
"timestamp": {
"gte": "2017-08-01 00:00:00",
"lte": "2017-08-31 23:59:59"
}
}
},
{
"match": {
"key": "SOME_KEY"
}
}
]
}
},
"size":0,
"aggs": {
// This one should be filtered and just count for interactive-bar*
"bar_count": {
"value_count": {
"field": "SOME_FIELD"
}
},
// This one should be filtered and just count for interactive-foo*
"foo_count": {
"value_count": {
"field": "SOME_FIELD"
}
}
}
}
【问题讨论】:
标签: elasticsearch