错误:index_not_found_exception

Far*_*iha 14 elasticsearch logstash kibana

我使用ELK堆栈来分析我的日志文件.我上周测试过,一切正常.

今天,我测试但是当我键入" http:// localhost:9200/iot_log/_count "(iot_log是我的索引模式)时出现此错误:

{"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"iot_log", "index_uuid":" na ","index":"iot_log"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id ":"iot_log","index_uuid":" na ","index":"iot_log"},"状态":404}

我真的搜索了论坛,但我还没有找到解决方案,我想知道这个问题的原因是什么,我该如何纠正呢?

Yao*_* Li 14

确保索引iot_log存在并创建它,如果不存在:

curl -X PUT "localhost:9200/iot_log" -H 'Content-Type: application/json' -d'{ "settings" : { "index" : { } }}'

  • 明确一点,这将创建一个名为“iot_log”的“索引”,因此我们可以将“iot_log”更改为我们想要的任何内容。 (4认同)

小智 7

您需要action.auto_create_indexelasticsearch.yml文件中设置参数。

例:

action.auto_create_index: -l*,+z*
Run Code Online (Sandbox Code Playgroud)

通过这种配置,将自动创建以“ z”开头的索引,而不会自动创建以“ l”开头的索引。