Hi,
I have a java method that creates a new document if it does not already exist otherwise sets a field in the doc to a value given a condition. This is done in a bulk request.
bulkRequest.add(client.prepareUpdate("tests", "test", "myId")
.setFields("_source")
.setScript("ctx._source.counter > 0 ? 20")
.setUpsert(contentBuilder)
The above does not work.
However if I remove the conditional check and simply increment the counter value it works (without changing anything else in the code).
bulkRequest.add(client.prepareUpdate("tests", "test", "myId")
.setFields("_source")
.setScript("ctx._source.counter += 1")
.setUpsert(contentBuilder)
Can someone please assist me as I do not know what I am doing wrong. I am using ES 1.0.
Thank you.
Dirk