2013-05-20 101 views
0

所以我有幾個文檔(5),我正在創建並嘗試更新。他們都是相似的,但我已經插入他們到elasticsearch後只是其中的一種迴應的Elasticsearch文檔沒有顯示或沒有路由集更新

curl localhost:9200/myindex/posts/:id 

,其中一個簡單的查詢:ID是一個替身在elasticsearch的_id編號。其他人給我一個

{"_index":"myindex","_type":"post","_id":":id","exists":false} 

然而,每當我做這樣的

curl localhost:9200/myindex/posts/:id?routing=3 

結果返回的查詢。

這不會這麼太大的問題,但是,我想要做輪胎使用這樣

Tire.index('myindex'){ update 'post', id, :doc => { :doc_body => content } } 

一些部分更新和更新無法顯示爲無法項目沒有指定路由號碼。

我只是想了解爲什麼elasticsearch是這樣表現的。

回答

0

所以我發現,因爲我使用的路由,我必須寫這樣

Tire.index('myindex'){ update 'post', id, { :doc => { :doc_body => content } } { :routing => routing_id } } 

的很酷的事情是,如果你使用的輪胎做搜索,它會自動將,找到更新文件使用路由。

所以

Tire.search('myindex'){ query { string '_id:xxx' } }.results 

會返回結果,其中

curl localhost:9200/myindex/posts/xxx 

實力

我還是不明白,爲什麼有些文件顯示了一個正常的GET請求及其他請勿索引後:\