我使用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}
我真的搜索了论坛,但我还没有找到解决方案,我想知道这个问题的原因是什么,我该如何纠正呢?
确保索引iot_log存在并创建它,如果不存在:
curl -X PUT "localhost:9200/iot_log" -H 'Content-Type: application/json' -d'{ "settings" : { "index" : { } }}'
您需要action.auto_create_index
在elasticsearch.yml
文件中设置参数。
例:
action.auto_create_index: -l*,+z*
通过这种配置,将自动创建以“ z”开头的索引,而不会自动创建以“ l”开头的索引。