# Client.setTimeout(millis) does not seem to work ( unlike ActionFuture.actionGet(millis) )

**URL:** <https://discuss.elastic.co/t/client-settimeout-millis-does-not-seem-to-work-unlike-actionfuture-actionget-millis/21414>\
**Category:** Elasticsearch\
**Created:** [December 28, 2014, 7:35pm UTC](https://discuss.elastic.co/t/client-settimeout-millis-does-not-seem-to-work-unlike-actionfuture-actionget-millis/21414 "2014-12-28T19:35:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashwin\_Jayaprakash](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Ashwin\_Jayaprakash](https://discuss.elastic.co/u/Ashwin_Jayaprakash)\
**Post date:** [December 28, 2014, 7:35pm UTC](https://discuss.elastic.co/t/client-settimeout-millis-does-not-seem-to-work-unlike-actionfuture-actionget-millis/21414/1 "2014-12-28T19:35:55Z")

</div>

Hi, our cluster has been experiencing some query timeouts which we  
originally attributed to GC issues. We resolved those but we still have  
timeouts.

_Question 1:_ We increased the timeout value in the search builder's action  
future. We did this by setting the future task's timeout value as shown  
below. Obviously this is the client side setting. We also tried to set the  
query side timeout but it does not seem to work.

I've pasted the example unit test code. Is this a known issue or are I  
doing something wrong?

_Question 2:_ When a ElasticsearchTimeoutException is thrown it does not  
report which shard failed or have any detail unlike the SearchResponse.  
Isn't that a little weird that the SearchResponse can report specific shard  
timeouts but the ElasticsearchTimeoutException cannot?

Thanks.

```
@Test
public void testSearchTimeoutReporting() {
    Settings settings = ImmutableSettings.builder()

```

.put(GroovyScriptEngineService.GROOVY\_SCRIPT\_SANDBOX\_ENABLED, "true")  
.put("script.disable\_dynamic", "false")  
.put("script.default\_lang", "groovy")  
.put("script.groovy.sandbox.receiver\_whitelist",

"com.appdynamics.analytics.processor.elasticsearch.exception.DetailedExceptionTest")  
.put(new  
ElasticSearchTestSingleNodeModule().buildSettings())  
.build();

```
    Node node = NodeBuilder.nodeBuilder()
            //No automatic/magic loading from classpath.
            .loadConfigSettings(false)
            .settings(settings)
            .node();
    Client client = node.client();

    client.admin().indices().prepareCreate("test")
            .execute().actionGet();

    client
            .prepareIndex("test", "type", "1").setSource("field", 

```

"value").setRefresh(true)  
.execute().actionGet();

```
    try {
        client
                .prepareSearch("test")
                .setTimeout(TimeValue.timeValueMillis(1))
                .setQuery(filteredQuery(matchAllQuery(),
                        scriptFilter(

```

"com.appdynamics.analytics.processor.elasticsearch.exception.DetailedExceptionTest.scriptCall();  
return true;")))  
.execute()  
//.actionGet(TimeValue.timeValueMillis(5));  
.actionGet();  
} catch (ElasticsearchTimeoutException e) {  
e.printStackTrace();  
}  
}

Map\<String, String\> buildSettings() {  
Map\<String, String\> nodeSettings = new HashMap\<\>();  
nodeSettings.put("gateway.type", "none");  
nodeSettings.put("node.name", "node-" +  
UUID.randomUUID().toString());  
nodeSettings.put("node.master", "true");  
nodeSettings.put("cluster.name", UUID.randomUUID().toString());  
nodeSettings.put("node.data", "true");  
nodeSettings.put("node.local", "true");  
nodeSettings.put("discovery.zen.ping.multicast.enabled", "false");  
nodeSettings.put("http.enabled", "false");

```
    nodeSettings.put("index.store.type", "memory");
    nodeSettings.put("index.store.fs.memory.enabled", "true");
    nodeSettings.put("index.gateway.type", "none");
    nodeSettings.put("index.number_of_shards", "1");
    nodeSettings.put("index.number_of_replicas", "0");

    nodeSettings.put("path.data", "build/data");

    //don't auto create the index
    nodeSettings.put("action.auto_create_index", "false");

    return nodeSettings;
}

```

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/a44d89ff-a825-46b8-837b-0f54f9555234%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a44d89ff-a825-46b8-837b-0f54f9555234%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:41am UTC](https://discuss.elastic.co/t/client-settimeout-millis-does-not-seem-to-work-unlike-actionfuture-actionget-millis/21414/2 "2017-07-06T00:41:43Z")

</div>


