I am trying to update a field type in my existing index mappings but getting BadRequestError using put_mapping method. The same method works to add a new field but not to update an existing one. Is there any other method available for the same?
In the below example, i am trying to change the date format of start_time
es_client.indices.put_mapping(index='test-index',properties=properties)
This is the error i got
raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
elasticsearch.BadRequestError: BadRequestError(400, 'illegal_argument_exception', 'Mapper for [start_time] conflicts with existing mapper:\n\tCannot update parameter [format] from [yyyy-MM-dd HH:mm:ss||epoch_millis] to [yyyy-MM-dd HH:mm:ss]')
CodePudding user response:
as it has been mentioned above in the comments, you cannot change a mapping once the index has been created
you need to delete the index, then recreate it with the correct setting