# UpdateByQueryResponse throwing timeout

**URL:** <https://discuss.elastic.co/t/updatebyqueryresponse-throwing-timeout/29176>\
**Category:** Elasticsearch\
**Created:** [September 12, 2015, 11:11am UTC](https://discuss.elastic.co/t/updatebyqueryresponse-throwing-timeout/29176 "2015-09-12T11:11:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![subramani.new](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@subramani.new](https://discuss.elastic.co/u/subramani.new)\
**Post date:** [September 12, 2015, 11:11am UTC](https://discuss.elastic.co/t/updatebyqueryresponse-throwing-timeout/29176/1 "2015-09-12T11:11:28Z")

</div>

Hi All,

I am Using "elasticsearch-action-updatebyquery"

Refer : [https://github.com/yakaz/elasticsearch-action-updatebyquery](https://github.com/yakaz/elasticsearch-action-updatebyquery)

API : The following api will do update bulk "Segment ids" to mached documents.

Example : segmentId= 50 needs to update on more then 20 million documents.

Map\<String, Object\> scriptParams = new HashMap\<String, Object\>();  
scriptParams.put("segmentexist", segId);  
scriptParams.put("pgsegmentobject", pgSegmentIds);

```
	UpdateByQueryClient updateByQueryClient = new UpdateByQueryClientWrapper(client);

	UpdateByQueryResponse response = updateByQueryClient.prepareUpdateByQuery().setIndices(props.getProperty("index")).setTypes(props.getProperty("type"))
			.setTimeout(TimeValue.timeValueHours(24))
			.setIncludeBulkResponses(BulkResponseOption.ALL)

			.setScript("if (ctx._source.containsKey(\"pgSegmentIds\") ) { if (ctx._source.pgSegmentIds.contains(segmentexist) ) { ctx.op = \"none\" } else { ctx._source.pgSegmentIds += pgsegmentobject} } else { ctx._source.pgSegmentIds = pgsegmentobject }")
			.setScriptParams(scriptParams)

			.setQuery(query)

			.execute()
			.actionGet();

```

Its failing while update. I see the following exception.

2015-09-12 05:58:10 INFO transport:123 - [Moon Knight] failed to get local cluster state for [#transport#-1][ip-10-186-199-195][inet[localhost/10.31.48.47:9300]], disconnecting...  
org.elasticsearch.transport.ReceiveTimeoutTransportException: [][inet[localhost/10.31.48.47:9300]][cluster/state] request\_id [416] timed out after [5000ms]  
at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:356)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)  
2015-09-12 05:58:10 INFO transport:123 - [Moon Knight] failed to get local cluster state for [PGMonetize-ES04][bqljhciDQ4-Tr2dRAcbWtw][ip-10-31-48-47][inet[/10.31.48.47:9300]]{master=true}, disconnecting...  
org.elasticsearch.transport.ReceiveTimeoutTransportException: [PGMonetize-ES04][inet[/10.31.48.47:9300]][cluster/state] request\_id [423] timed out after [5001ms]  
at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:356)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at java.lang.Thread.run(Thread.java:745)

I have done following setup

1. We are having 5 nodes, with 5 shards.
2. We have set, put("client.transport.sniff", true)

still I get the above exception. Please help.

---

<div class="post-metadata">

**Author:** ![subramani.new](https://avatars.discourse-cdn.com/v4/letter/s/e0b2c6/32.png) [@subramani.new](https://discuss.elastic.co/u/subramani.new)\
**Post date:** [September 16, 2015, 4:41pm UTC](https://discuss.elastic.co/t/updatebyqueryresponse-throwing-timeout/29176/2 "2015-09-16T16:41:35Z")

</div>

any update on this?

---

<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:** [July 5, 2017, 11:49pm UTC](https://discuss.elastic.co/t/updatebyqueryresponse-throwing-timeout/29176/3 "2017-07-05T23:49:57Z")

</div>


