# UpdateByQuery can not batch execute

**URL:** <https://discuss.elastic.co/t/updatebyquery-can-not-batch-execute/71195>\
**Category:** Elasticsearch\
**Created:** [January 11, 2017, 9:04am UTC](https://discuss.elastic.co/t/updatebyquery-can-not-batch-execute/71195 "2017-01-11T09:04:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasstionzyf](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@jasstionzyf](https://discuss.elastic.co/u/jasstionzyf)\
**Post date:** [January 11, 2017, 9:04am UTC](https://discuss.elastic.co/t/updatebyquery-can-not-batch-execute/71195/1 "2017-01-11T09:04:00Z")

</div>

Hello, guys!  
currently i have an index, like it have three fields: id, otherIds(split by ","), score.  
now i have such requirement:  
i want to update the score by query at otherIds,  
the udpateByQuery api can meet my needs like blow:

```
UpdateByQueryRequestBuilder ubqrb = UpdateByQueryAction.INSTANCE.newRequestBuilder(
                        EpScoreComputeAndUpdate.client_statistics1);
               ctx._source.grade=newGrade;
               String inlineScript="if(ctx._source.grade == null) ctx._source.grade=newGrade; else if(ctx._source.grade<newGrade) ctx._source.grade=newGrade";
                  Map<String,Object> params=Maps.newHashMap();
                            params.put("newGrade",0);
                            Script script = new Script(inlineScript, org.elasticsearch.script.ScriptService.ScriptType.INLINE, org.elasticsearch.script.ScriptService.DEFAULT_LANG, params);
    ubqrb.source("vcg_editorial")
                        .script(script)
                        .filter(QueryBuilders.termQuery("otherIds","386022522"));
                   BulkIndexByScrollResponse response= ubqrb.get();

```

but i can not batch execute them.

anyone know why batch execute UpdateByQueryRequest is not supported? or i miss something?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 8, 2017, 9:04am UTC](https://discuss.elastic.co/t/updatebyquery-can-not-batch-execute/71195/2 "2017-02-08T09:04:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
