2016-03-21 39 views
8

我想向我的映射添加一些額外的屬性,在這種特定情況下,我想修改英文索引中的標題字段,以便它使用英文分析器。在ElasticSearch上設置update_all_types爲true

應該是非常簡單的,除了我在某些類型的標題字段,並且它似乎是不可能做到這一點。

我的錯誤是:設置update_all_types爲true,在所有類型的更新[search_quote_analyzer]

但我無法找到如何或在哪裏設置這個「update_all_types」一個單一的參考。參數。

這是非常簡單的代碼我在使用感:

PUT /my_index/_mapping/my_type 
    { 
     "properties": { 
     "title": { 
      "type": "string", 
      "analyzer": "english" 
     } 
     } 
    } 

所以,我怎樣才能使這項工作,如果同一領域中其他類型的使用?

這是錯誤消息:

"type": "illegal_argument_exception", 
"reason": "Mapper for [title] conflicts with existing mapping in other types: 
    [mapper [title] has different [analyzer], mapper [title] is used by 
    multiple types. Set update_all_types to true to update [search_analyzer] 
    across all types., mapper [title] is used by multiple types. Set 
    update_all_types to true to update [search_quote_analyzer] across 
    all types.]" 

所以看起來我需要設置「update_all_types:真正的」某處,但該部分的文檔失敗。

+0

文檔,您將登陸[正確的頁面](https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-put-mapping.html#merging-conflicts);-) – Val

+0

Ouch ,似乎我忽略了那一個。 無論如何,似乎沒有工作,因爲現在我得到一個不同的錯誤,我會更新原來的文章 – Wokoman

+0

最有可能的是,你的另一種類型的字段'標題'已經有不同的分析器(即不同類型爲'my_type'的'title'分析器)。可能?你可以顯示'GET my_index'的輸出嗎? – Val

回答

6

你可以找到文檔here

update_all_types是一個GET參數給這樣的: PUT my_index/_mapping/type_one?update_all_types

1

我也有類似的問題,請嘗試下面的代碼更新所有的類型:如果您在使用搜索功能

PUT /my_index/_mapping/my_type?update_all_types 
    { 
     "properties": { 
     "title": { 
      "type": "string", 
      "analyzer": "english" 
     } 
     } 
    } 
相關問題