I want to return something so that I can identify that the below update is exceuted from "if " section or the "else" section. Is there a way to return or throw an exception
POST customer/_update_by_query
{
"script":{
"source":"""
if(some condition)
{
// some processing
}
else
// throw some exception or return something so that it can be identified
"""
},
"query":{
// some Query here
}
I am not sure I fully get the requirement, do you want to update the document in both cases or only in one. If the latter you can set ctx.op = "noop" which means, the document will not get updated. If the former, than it might make sense to add a second field which describes which action had been taken.
It is the latter one i.e. I want to update in only one case.
Your answer is helpful but what if I want to return some personalized message
through the response of the query if it go to the "else" case.
Will I be able to do that.
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.