i have a use case of update by query in elastic search.
I am keeping a doc like -
"a" : "1",
"b" : "2",
"version1" : 456
"c" : {
"version2" : 123,
"d" : "3"
}
Now dependently for my use case-
- I either want to update field a, b and version1
- Or I will update field d and version2.
I got partial answer in Update By Query in Elasticsearch using Java.
I am trying things like this-
BulkIndexByScrollResponse r = ubqrb.script(script)
.script(script1)
.script(script2)
.script(script3)
.script(script4)
.filter(qb).get();
However UpdateByQueryRequestBuilder
doesn't allow me to give multiple scripts and only and last one, ie script4
is used and rest are neglected.
I also tried -
Script script4 = new Script("ctx._source.a=\"abc\",b=\"xyz\"");
However this one also failed.
Any idea what can be done using update by where. Thanks in advance