如何對 ElasticSearch 重新索引
source link: https://blog.niclin.tw/2016/07/09/%E5%A6%82%E4%BD%95%E5%B0%8D-elasticsearch-%E9%87%8D%E6%96%B0%E7%B4%A2%E5%BC%95/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Nic Lin's Blog
喜歡在地上滾的工程師
有時候會遇到,資料庫明明已經destroy了,但是ElasticSearch的索引依舊還在,對他下搜尋指令還是能夠給你舊資料的索引,這時候如果你直接不理會並且加入新的索引,那下搜尋指令出來的結果就會變成
「舊有已刪除的資料」+「現有資料」所湊成的Hash。
這樣是相當困擾的,所以我們必須Reindex。
一般來說我們的ElasticSearch Server會預設架在本機port 9200上 以下直接在command輸入
針對某個index做刪除
curl -XDELETE localhost:9200/index/type/documentID
刪除指定index
curl -XDELETE 'http://localhost:9200/shop/product/1'
刪除目錄下所有index
curl -XDELETE 'http://localhost:9200/shop'
刪除所有index
curl -XDELETE 'http://localhost:9200/_all'
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK