How can i update a doc with script in java api 1.7

(LDA) #1

my method like this:
ESUtil.getClient().prepareUpdate("ttl", "doc", "1")
.setScript(new Script("ctx._source.gender = "male"" , ScriptService.ScriptType.INLINE, null, null))
but the Script class is not in api 1.7 ,?
please help me how can i use script in 1.7? i want to update a doc like this:
"script" : "lookNum=lookNum+1" ,but for update in 1.7 , i must query the result first and then update use UpdateRequest like this:
UpdateRequest update=new UpdateRequest();
XContentBuilder xcon=null;
try {
xcon = XContentFactory.jsonBuilder()
.field(upField, lookNum)
} catch (IOException e) {

(David Pilato) #2

Have a look at

(system) #3