Hey all,
I had a field name with a typo. Let's say it was called Helo.keyword.
I have created a new field with the correct name Hello.keyword.
New data is populating the new field.
How can I copy the old values to the new field created?
This is a one-time operation. After the values are copied I will delete the old field from the index.
I tried the following script, but it does not update any document
Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.
A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.
Without that it's hard to know but let's make some guesses. May be the type is actually _doc and not test.
You can look also at the rename processor and the reindex API. So you reindex in a new clean index instead of keeping the old mapping around.
Hi @dadoonet
Thank you for the reply.
I do not have a full recreation scripts as I was not involved in the entire process.
Let me know what info I should provide, and I'll do it with pleasure.
The script, as I understand it:
POST /test/text/_update_by_query - test is the index name
POST /test/text/_update_by_query - text is the field type
POST /test/text/_update_by_query - update by query is the method
I do not want to use the re-index API, as there are multiple indices with multiple fields I need to update and I am afraid it will cause issues/a mess with the data. I prefer the approach of updating and then deleting 1 field at a time.
Could you create a sample script with some fake data so we can start from there to help you fixing the problem?
If you look at the link I provided, a sample script is something we can paste into Kibana dev console and play.
look at the sample script provided in the link.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.