簡體   English   中英

Elasticsearch索引/緩存未清除/卡住

[英]Elasticsearch index/cache not clearing/stuck

我正在使用https://github.com/firebase/flashlight為搜索數據編制索引

但是,今天早上,我刪除了整個Firebase索引,因此它應該為空(此方法以前曾起作用,但似乎在某些情況下,當nodejs app.js崩潰時,導致緩存“卡住”),但我仍然以某種方式查看我的nodejs應用中的舊搜索結果...

我試過了:

http://localhost:9200/_cache/clear

http://localhost:9200/_flush
http://localhost:9200/firebase/_flush

他們都說成功了,但我仍然取得了old results ,似乎無濟於事。

我還可以在控制台中看到它每60秒刷新一次,並且刪除整個Firebase之前一直沒有問題...

我什至看到了一條消息, housekeeping: found 60 orphans (removing them now)在控制台中housekeeping: found 60 orphans (removing them now) ,因此現在應該刷新...

我嘗試重新啟動elasticsearch以及整個Linux / Debian服務器...

在config.js中,我有兩個索引:

exports.paths = [
   {
      path:  "tags",
      index: "firebase",
      type:  "tag",
      filter: function(data) { return data.name !== 'system'; }
   },
   {
      path:  "tracks",
      index: "firebase",
      type:  "track",
      filter: function(data) { return data.name !== 'system'; }
   }
];

奇怪的是,使用“ track”商店而不是使用“ tag”商店時,我沒有任何問題。

我在這里想念什么?

//更新!

因此,我只是在運行nodejs腳本時刪除了Firebase tracks索引,並且腳本crashed ……同樣的問題,不同的索引。 因此, crashing script must cause it ...因此,如何clear this stuck cache

所以我通過簡單地解決它:

curl -XDELETE localhost:9200/Firebase

感謝: https : //github.com/elasticsearch/elasticsearch/issues/7541#issuecomment-54724302

我猜彈性搜索不知道(也沒有告知)它當前索引的相關性,也許我正在使用的Flashlight腳本沒有告知它應該是什么索引? 但是,由於僅在突然刪除整個Firebase索引時節點腳本崩潰時才需要這樣做,因此它應該可以某種方式捕獲,但是我很高興至少可以這樣解決。 現在,重建索引不是一個大問題/任務,但將來可能會。

一個瘋狂的猜測,也許您沒有正確發布查詢。 您說您嘗試了以下鏈接:

http://localhost:9200/_cache/clear
http://localhost:9200/_flush
http://localhost:9200/firebase/_flush

如果您是從瀏覽器訪問網址,則不會清除它們。 您必須發布它們。 從您的問題是否進行過模棱兩可,GET和POST都返回相同的結果(顯示總計,成功和失敗)。 使用curl從命令行嘗試以下操作:

curl -XPOST 'http://localhost:9200/_cache/clear'
curl -XPOST 'http://localhost:9200/_flush'

或使用JQuery創建AJAX請求或使用提琴手。

通過將以下POST請求發送到您的elasticsearch服務器來嘗試優化您的指標:

curl -XPOST 'http://localhost:9200/_optimize?max_num_segments=1&wait_for_merge=true'

它使lucene真正從磁盤上刪除已刪除的文檔並合並索引。

暫無
暫無

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

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