2013-05-20 62 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请求及其他请勿索引后:\