I am using Elasticsearch 6.5.
I want to use an update API with the painless script. Let's say, that my target document has an address structure inside of it. Update script may look something like this:
Which usually runs great. But there are documents, that do not have an address structure. In these cases update script fails with null_pointer_exception error - then I am addressing inner field of not existing structure.
So basically my questions are:
How to detect in painless, that document does not have an address structure?
How to create this inner structure and set values to it?
To answer questions that may arise: making the whole document flat (just fields without inner structure) is not an option in my case. Also, I cannot modify documents to ensure, that everyone has an address structure, before an update script.
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.