PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 25, 2022

[FIXED] How to update/change the existing field type in a mapping of an index in elasticsearch using python?

 October 25, 2022     elasticsearch     No comments   

Issue

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]')


Solution

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



Answered By - warkolm
Answer Checked By - Willingham (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing