簡體   English   中英

錯誤:index_not_found_exception

[英]Error: index_not_found_exception

我使用 ELK 堆棧來分析我的日志文件。 我上周進行了測試,一切正常。

今天,我進行了測試,但是當我輸入“ http://localhost:9200/iot_log/_count ”(iot_log 是我的索引模式)時出現此錯誤:

{"error":{"root_cause":[{"type":"index_not_found_exception","re​​ason":"沒有這樣的索引","re​​source.type":"index_or_alias","re​​source.id":"iot_log", "index_uuid":" na ","index":"iot_log"}],"type":"index_not_found_exception","re​​ason":"沒有這樣的索引","re​​source.type":"index_or_alias","re​​source.id ":"iot_log","index_uuid":" na ","index":"iot_log"},"status":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”開頭的索引則不會。

使用設置解決它的最佳方法如下

允許自動創建 YourIndexName 和 index10,不允許任何與 index1* 匹配的索引名稱和任何其他與 ind* 匹配的索引名稱。 模式按照它們給出的順序進行匹配。

curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'{
    "persistent": {
        "action.auto_create_index": "YourIndexName,index10,-index1*,+ind*" 
    }
}'

停止任何自動索引

curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'{
    "persistent": {
        "action.auto_create_index": "false" 
    }
}'

允許自動創建任何索引

curl -X PUT "localhost:9200/_cluster/settings?pretty" -H 'Content-Type: application/json' -d'{
    "persistent": {
        "action.auto_create_index": "true" 
    }
}'
```

就我而言,我的所有數據都在彈性搜索中自動刪除,在彈性搜索中再次導入數據后,我的應用程序運行良好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM