【发布时间】:2021-06-05 01:07:29
【问题描述】:
我不明白为什么如果我使用这样的过滤器查询 Elasticsearch:
curl -H'content-type: application/json' "localhost:9200/.kibana/_search" -d '{
"query": {
"bool": {
"filter": [
{
"term": {
"type": "index-pattern"
}
}
]
}
}
}'
{"took":0,"timed_out":false,"_shards":{"total":4,"successful":4,"skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]}}
如您所见,我的结果集为空。 但相反,我确实有一个“类型”字段等于“索引模式”的文档。
{
"_index": ".kibana",
"_type": "_doc",
"_id": "index-pattern:c37de740-7e94-11eb-b6c2-4302716621be",
"_score": 0,
"_source": {
"index-pattern": {
"title": "r*",
"timeFieldName": "@timestamp",
"fields": "<omitted - too long>"
},
"type": "index-pattern",
"references": [],
"migrationVersion": {
"index-pattern": "7.6.0"
},
"updated_at": "2021-03-06T15:58:18.062Z"
}
}
我的查询有什么问题?
【问题讨论】:
-
我目前无权访问任何本地 Elasticsearch 实例,但
type字段的类型是什么?keyword,text? -
@EvaldasBuinauskas
type始终是keyword,至少在我所有的 kibana 实例中是这样。 @sscarduzio 可以请仔细检查映射吗?另外,直接访问该 ID,即curl localhost:9200/.kibana/_doc/index-pattern:c37de740-7e94-11eb-b6c2-4302716621be会产生什么吗? -
@EvaldasBuinauskas 来自 GET /.kibana,我看到了映射。这是类型字段:“type”:{“type”:“text”,“fields”:{“keyword”:{“type”:“keyword”,“ignore_above”:256}}},
-
@JoeSorocin,是的,该文档全部归结为: curl localhost:9200/.kibana/_doc/index-pattern:c37de740-7e94-11eb-b6c2-4302716621be
标签: elasticsearch elasticsearch-dsl