# Java High Level Rest Client response time is lower than Transport client

**URL:** <https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809>\
**Category:** Elasticsearch\
**Created:** [February 11, 2019, 9:10am UTC](https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809 "2019-02-11T09:10:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganil.89](https://avatars.discourse-cdn.com/v4/letter/g/85f322/32.png) [@ganil.89](https://discuss.elastic.co/u/ganil.89)\
**Post date:** [February 11, 2019, 9:10am UTC](https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809/1 "2019-02-11T09:10:50Z")

</div>

I have upgraded code from transport client to High Level client.  
Java: JDK 8  
ES version: 6.5.4

When api response time of transport client is compared to High Level client, there is a difference, especially EXTERNAL-CALL, i.e., org.elasticsearch.client.RestHighLevelClient operation is taking more time.

RestHighLevel client is initialised and used in standard way.

HttpHost httpHosts = // code to get hosts;

RestClientBuilder builder = RestClient.builder(httpHosts);  
RestHighLevelClient restHighLevelClient = new RestHighLevelClient(builder.getRestClient());

Please suggest me if there is any way to tune for better response time and performance.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 11, 2019, 9:48am UTC](https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809/2 "2019-02-11T09:48:56Z")

</div>

You should not really see a notable difference of the response time.

Could you share the test code you are using with the Transport Client and the Rest Client? Also the measured time for both against the exact same dataset using the exact same queries?

---

<div class="post-metadata">

**Author:** ![ganil.89](https://avatars.discourse-cdn.com/v4/letter/g/85f322/32.png) [@ganil.89](https://discuss.elastic.co/u/ganil.89)\
**Post date:** [February 11, 2019, 10:07am UTC](https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809/3 "2019-02-11T10:07:56Z")

</div>

I am not able to share due to restrictions. I used elastic search Query builders, SearchRequest and finally used search method of RestHighLevelClient to search in Elastic Search.

Time took for  
Transport client is \< 2000 ms  
RestHighLevelClient is \> 3000 ms

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 11, 2019, 10:26am UTC](https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809/4 "2019-02-11T10:26:55Z")

</div>

I can't help.

---

<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:** [March 11, 2019, 10:27am UTC](https://discuss.elastic.co/t/java-high-level-rest-client-response-time-is-lower-than-transport-client/167809/5 "2019-03-11T10:27:07Z")

</div>

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