Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set update_all_types to true on ElasticSearch

I want to add some additional properties to my mappings, in this specific case I want to modify a title field in my English index so that it would use the english analyzer.

Should be pretty straightforward, except that I have a title field in quite some types, and it seems to be not possible to do this.

The error I have is the following : Set update_all_types to true to update [search_quote_analyzer] across all types.]

But I am not able to find a single reference on how or where to set this 'update_all_types' parameter.

This is the very simple code I use in Sense :

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

So, how can I make this work if the same field is used in other types ?

This is the error message :

"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.]"

So it seems I need to set 'update_all_types:true' somewhere, but the documentation fails on that part.

like image 618
Wokoman Avatar asked Mar 21 '16 16:03

Wokoman


2 Answers

You can find the documentation here !

The update_all_types is a get parameter to give like that : PUT my_index/_mapping/type_one?update_all_types

like image 121
Dowdow Avatar answered Sep 21 '22 11:09

Dowdow


I had a similar issue, try the code below to update all types:

   PUT /my_index/_mapping/my_type?update_all_types
    {
      "properties": {
        "title": {
          "type": "string",
          "analyzer": "english"
        }
      }
    }
like image 36
EricPSU Avatar answered Sep 20 '22 11:09

EricPSU