elasticsearch - Trying to understand how to update a mapping without requiring a complete rebuild of the index? -


from page: https://www.elastic.co/blog/changing-mapping-with-zero-downtime states:

i don't care old data if want change datatype single field, , don't care fact old data not searchable? in case, have few options:

delete mapping if delete mapping specific type, can use put_mapping api. create new mapping type in existing index.

...

my situation is, have column string, , want change long... according document, sounds should able do:

curl -x delete localhost:9200/my_index/_mapping/property_to_change 

and do

curl -xput 'http://localhost:9200/my_index/_mapping/property_to_change' -d ' {     "my_index" : {         "properties" : {             "property_to_change" : {"type" : "long", "store" : true }         }     } } ' 

am misunderstanding this? have go through trouble of creating alias? there not simple way can change 1 property's type?

i find documentation regarding topic high confusing , contradictory.. example page https://www.elastic.co/guide/en/elasticsearch/guide/current/mapping-intro.html says:

you can specify mapping type when first create index. alternatively, can add mapping new type (or update mapping existing type) later, using /_mapping endpoint.

which sounds -- ok cool. that's want do.

but next paragraph says:

although can add existing mapping, can’t change it. if field exists in mapping, data field has been indexed. if change field mapping, indexed data wrong , not searchable.

i thought said can update mapping? says can't change it? sooo confused.

can please shed light on this?

you can't change mappings existing fields. in elasticsearch parlance, type class of similar documents can put updated mapping (which adds new field mappings) can't change existing mapping field.

for example, given documents type contains mapping title , tags fields, put updated mapping type adds mapping author field, couldn't change tags 1 type another, or change mapping options or whatnot.

if want change field string long, you're going need drop index (or mapping type, equivalent if index contains 1 type), create new index desired mapping, , reindex data it.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -