node.js - How to update elasticsearch field type -
i need update elasticsearch field type integer long tried following way , not works
curl -xput 'http://localhost:9200/testwork/_mapping/message?ignore_conflicts=true' -d ' { "message" : { "properties" : { "status" : {"type" : "long"} } } } '
when tried without ignore_conflicts parameter getting error like
{"error":"mergemappingexception[merge failed failures {[mapper [status] of different type, current_type [integer], merged_type [long]]}]","status":400}
but not error while using ignore_conflicts parameter got response like
{"acknowledged":true}
but type not changed status field. please me this
it not possible change data type if have data present.
you'll have delete index, create mapping data type want, , re-index data.
to re-index need export , re-import data - there tools (scan&scroll , bulk api) make easier, see reindexing data.
an alternative create new index , use aliasing - i.e. when doing insert write latest index (could use alias single index in it), when doing query, read alias includes relevant indexes (new , old versions of index).
Comments
Post a Comment