PUT my_id1/_create {
"locations" : [ "abc","xyz"]
}
I want to use this to remove in-consistencies in the input data. Rename "locations" field if it is an array so there is no mapping error when the documents are inserted.
Can I do this using "scripting" or "Grok" processor ?
Any help or suggestions will be very helpful.
You could use a script processor for that, and make use of the fact that an object is a HashMap and an array is a LinkedList. For example, the pipeline in the _simulate request below will first rename the location field to location.original and next create a new field location.array if the field is an array (instance of List), or a new field location.object if the field is an object (instanceof Map).
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.