2014-07-21 18 views
11

我試圖填充有父子關係的對象,但得到一個錯誤:ElasticSearch RoutingMissingException

[彈性曲線\異常\ ResponseException] RoutingMissingException [需要[myindex]/[註釋路由]/[ 12345]

從類型的conf摘錄:

article: 
    _source: 
     enabled: false 
    mappings: 
     ... 

comment: 
    _source: 
     enabled: false 
    _parent: 
     type: article 
     property: article_id 
     identifier: id 
    _routing: 
     required: true 
     path: article_id 
    mappings: 
     article: 
      type: long 
      index: not_analyzed 
     ... 

無法理解什麼,我在這裏失蹤....

我使用Symfony2.3,FOSElasticaBundle 3.0,ElasticSearch 1.2.2

+0

你好@JognSmith,你可以請編輯您的答案,並添加作曲家線的版本? FOSElasticaBundle,展示你的實體如何映射到代碼中?我在同樣的錯誤下超過2天,這讓我瘋狂。謝謝! – Cassiano

+0

@Cassiano,我的問題是映射中的字段不正確(正如我在下面的答案中所述)。更正了原始問題。檢查你的映射。 – JohnSmith

+0

我已經檢查過了。這就是爲什麼我向你要求其他東西作爲作曲家標籤/分支和關聯映射的實體 – Cassiano

回答

0

在映射中有拼寫錯誤。

comment: 
    mappings: 
     article_id: <-- was "article" 
      type: long 
      index: not_analyzed 

也許這可以幫助別人:)

20

當你有一個父子關係,你需要在每次嘗試訪問一個孩子時指定的URL的父母,因爲現在路由依賴於家長。

在你的榜樣,你會想嘗試:

http://example.com/myindex/comment/12345父=的article_id]

+2

當使用Query DSL時,情況仍然如此嗎? – Erutan409