在ElasticSearch上将update_all_types设置为true

Wok*_*man 15 elasticsearch

我想为我的映射添加一些额外的属性,在这种特殊情况下,我想修改我的英文索引中的标题字段,以便它使用英文分析器.

应该非常简单,除了我有很多类型的标题字段,似乎不可能这样做.

我遇到的错误如下:将update_all_types设置为true以更新所有类型的[search_quote_analyzer].

但我无法找到关于如何或在何处设置此'update_all_types'参数的单一参考.

这是我在Sense中使用的非常简单的代码:

PUT /my_index/_mapping/my_type
    {
      "properties": {
        "title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
Run Code Online (Sandbox Code Playgroud)

那么,如果在其他类型中使用相同的字段,我该如何才能完成这项工作呢?

这是错误消息:

"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.]"
Run Code Online (Sandbox Code Playgroud)

所以我似乎需要在某处设置'update_all_types:true',但文档在那部分失败了.

小智 14

你可以在这里找到文档!

update_all_types是一个get参数,如下所示: PUT my_index/_mapping/type_one?update_all_types


小智 5

我遇到了类似的问题,请尝试下面的代码来更新所有类型:

   PUT /my_index/_mapping/my_type?update_all_types
    {
      "properties": {
        "title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
Run Code Online (Sandbox Code Playgroud)