【发布时间】:2014-11-21 12:28:13
【问题描述】:
我想按index->按index_type->文本搜索数据这个顺序在ES上搜索数据。
当我在“_index”上使用以下查询时,我希望获得该特定 _index 下的 index_types 列表以及相关数据,但它什么也没返回。另一方面,当我通过 _type 搜索时,我得到了与 index_type 相关的数据。我哪里出错了?
curl -XGET 'http://localhost:9200/_all/_search?pretty' -d '{
"facets": {
"terms": {
"terms": {
"field": "_index",
"size": 10,
"order": "count",
"exclude": []
},
"facet_filter": {
"fquery": {
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "*"
}
}
]
}
},
"filter": {
"bool": {
"must": [
{
"terms": {
"_index": [
"<index_name>"
]
}
}
]
}
}
}
}
}
}
}
},
"size": 0
}'
注意:我首先在 Kibana 上遇到了这个问题,在那里我使用了过滤器 "_index":"name_of_index";它没有返回任何结果,但 "_type":"name_of_index_type" 返回了预期的结果。我发现 Kibana 在后台使用上述查询来获取我尝试过的过滤器的结果。
【问题讨论】:
-
为什么不在 url 中指定索引?使用“aggs”(聚合),因为构面已贬值。
标签: elasticsearch kibana facets