首页 > 解决方案 > _msearch api 无法正常工作

问题描述

我有一个具有多个索引和索引模式的弹性搜索集群。他们中的大多数工作正常。

但是对于一种日志索引,当我通过_msearchapi 查询并使用索引模式(比如a-index-*)时,我得到一个空响应

{"responses":[{"took":0,"timed_out":false,"_shards":{"total":0,"successful":0,"skipped":0,"failed":0},"hits":{"total":0,"max_score":0,"hits":[]},"status":200}]}

如果我对索引本身(例如a-index-2019-10)运行相同的查询,我会得到预期的响应。另外,如果我_search对索引模式使用 api,则响应是正确的。

我正在使用 对此进行测试curl,因此问题显然出在 elasticsearch 中,但我无法找出原因。

此查询(在索引上)返回结果

curl 'localhost:9200/_msearch' -H 'content-type: application/x-ndjson'  --data $'{"index":["a-index-2019-10"]}\n{"version":true,"size":0,"query":{"match_all":{}}}\n'

此查询(在索引模式上)不返回任何结果

curl 'localhost:9200/_msearch' -H 'content-type: application/x-ndjson'  --data $'{"index":["a-index-2019-10*"]}\n{"version":true,"size":0,"query":{"match_all":{}}}\n'

标签: elasticsearchelasticsearch-5

解决方案


推荐阅读