# ElasticSearch High-level client response is getting delay?

**URL:** <https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657>\
**Category:** Elasticsearch\
**Created:** [May 5, 2019, 8:55am UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657 "2019-05-05T08:55:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aashrithVarikuti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aashrithvarikuti/32/42539_2.png) [@aashrithVarikuti](https://discuss.elastic.co/u/aashrithVarikuti)\
**Post date:** [May 5, 2019, 8:55am UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/1 "2019-05-05T08:55:55Z")

</div>

I am using high-level client version 6.3 version. Whenever I hitting request I am getting response very quickly and sometimes it's delaying. I am not seeing standard load time for the same request:

SearchResponse Duration \>\>\>\>\> 10065MS  
SearchResponse Duration \>\>\>\>\> 150001MS  
SearchResponse Duration \>\>\>\>\> 15065MS  
SearchResponse Duration \>\>\>\>\> 4134MS

Every-time I am seeing different load time. Below is the code snippet:

```
public static SearchResponse elasticSearchQuery(SearchRequest queryRequest) {
     try (RestHighLevelClient restHighLevelClient = buildRestHighLevelClient(env)) {
         SearchResponse searchResponse = restHighLevelClient.search(queryRequest);
         return searchResponse;
     }
}
```

---

<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:** [May 6, 2019, 10:08am UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/2 "2019-05-06T10:08:43Z")

</div>

Are you building a new HLClient every time? or sharing a singleton?

Anything in elasticsearch logs while this is happening? ie some GC events?

---

<div class="post-metadata">

**Author:** ![aashrithVarikuti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aashrithvarikuti/32/42539_2.png) [@aashrithVarikuti](https://discuss.elastic.co/u/aashrithVarikuti)\
**Post date:** [May 6, 2019, 8:17pm UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/3 "2019-05-06T20:17:00Z")

</div>

Yes, I am and Here is the logs:

```
/537.36","testValueForHeader":{"present":false},"routingInfo":null,"productRoutingInfo":null,"requestPayload":{"initiator":"PRODUCT_UI_SEARCH","version":"2018","project":"IND","subProduct":"Samsungx","changeItems":[{"changeType":"MODEL","sourceVersion":"1.0","sourceType":"PRODUCT_MODEL","sourceData":"{\"prodId\":\"SAMSUNG108\",\"fieldId\":\"PRO\",\"instanceId\":\"0\",\"Change\":\"CHANGED\",\"details\":\"\"}"}]}}
{"@timestamp":"2019-05-06T12:10:01.569-07:00","@version":"1","message":"createProduct called for impact entity id 9561-e77e0e625187","logger_name":"com.ecom.sercives.ProductService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
{"@timestamp":"2019-05-06T12:10:01.569-07:00","@version":"1","message":"Override alias headers - {}","logger_name":"com.ecom.sercives.ProductService","thread_name":"http-nu`Preformatted text`e-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
{"@timestamp":"2019-05-06T12:10:01.574-07:00","@version":"1","message":"Searching for MEF mapping for PRODUCT SAMSUNGG180.1840 in mapping library environment PREPROD","logger_name":"com.ecom.services.ProductMappingService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
<<<<<<<<<<<<<<<<< RestHighLevelClient buildRestHighLevelClient Duration >>>>>>>>>>>>>>>>>> 62
{"@timestamp":"2019-05-06T12:10:06.356-07:00","@version":"1","message":"ElasticSearch high level client","logger_name":"com.ecom.sercives.ProductHighLevelElasticSearch","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
<<<<<<<<<<<<<<<<< product - ElasticSearchQuery SearchResponse Duration >>>>>>>>>>>>>>>>>> 278
{"@timestamp":"2019-05-06T12:10:06.639-07:00","@version":"1","message":"Found no mapping for PRODUCT SAMSUNGG180.1840 in mapping library environment PREPROD","logger_name":"com.ecom.services.ProductMappingService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
{"@timestamp":"2019-05-06T12:10:06.639-07:00","@version":"1","message":"No mapped MEF field found for product SAMSUNG.1080","logger_name":"com.ecom.sercives.ProductService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
{"@timestamp":"2019-05-06T12:10:06.641-07:00","@version":"1","message":"Beginning product field Elastic requests","logger_name":"com.ecom.services.ProductSService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
{"@timestamp":"2019-05-06T12:10:06.643-07:00","@version":"1","message":"Executing all product field Elastic requests in thread pool","logger_name":"com.ecom.services.ProductSService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
<<<<<<<<<<<<<<<<< product SearchRequest generation Duration >>>>>>>>>>>>>>>>>> 0
<<<<<<<<<<<<<<<<< product SearchRequest generation Duration >>>>>>>>>>>>>>>>>> 0
<<<<<<<<<<<<<<<<< product SearchRequest generation Duration >>>>>>>>>>>>>>>>>> 0
<<<<<<<<<<<<<<<<< RestHighLevelClient buildRestHighLevelClient Duration >>>>>>>>>>>>>>>>>> 5
<<<<<<<<<<<<<<<<< RestHighLevelClient buildRestHighLevelClient Duration >>>>>>>>>>>>>>>>>> 5
<<<<<<<<<<<<<<<<< RestHighLevelClient buildRestHighLevelClient Duration >>>>>>>>>>>>>>>>>> 5
{"@timestamp":"2019-05-06T12:10:06.649-07:00","@version":"1","message":"ElasticSearch high level client","logger_name":"com.ecom.sercives.ProductHighLevelElasticSearch","thread_name":"pool-6-thread-2","level":"INFO","level_value":20000}
{"@timestamp":"2019-05-06T12:10:06.649-07:00","@version":"1","message":"ElasticSearch high level client","logger_name":"com.ecom.sercives.ProductHighLevelElasticSearch","thread_name":"pool-6-thread-3","level":"INFO","level_value":20000}
{"@timestamp":"2019-05-06T12:10:06.650-07:00","@version":"1","message":"ElasticSearch high level client","logger_name":"com.ecom.sercives.ProductHighLevelElasticSearch","thread_name":"pool-6-thread-1","level":"INFO","level_value":20000}
<<<<<<<<<<<<<<<<< product - ElasticSearchQuery SearchResponse Duration >>>>>>>>>>>>>>>>>> 172
{"@timestamp":"2019-05-06T12:10:06.823-07:00","@version":"1","message":"<<<<<<<<<<<<<<<<< In-side the getProductItems() SearchResponse Duration >>>>>>>>>>>>>>>>>> 180","logger_name":"com.ecom.clients.ElasticProductClient","thread_name":"pool-6-thread-2","level":"INFO","level_value":20000}
{"@timestamp":"2019-05-06T12:10:06.825-07:00","@version":"1","message":"<<<<<<<<<<<<<<<<< ProcessingProductSeachResponse() Duration >>>>>>>>>>>>>>>>>> 1","logger_name":"com.ecom.clients.ElasticProductClient","thread_name":"pool-6-thread-2","level":"INFO","level_value":20000}
<<<<<<<<<<<<<<<<< product - ElasticSearchQuery SearchResponse Duration >>>>>>>>>>>>>>>>>> 1565
{"@timestamp":"2019-05-06T12:10:08.218-07:00","@version":"1","message":"<<<<<<<<<<<<<<<<< In-side the getProductItems() SearchResponse Duration >>>>>>>>>>>>>>>>>> 1574","logger_name":"com.ecom.clients.ElasticProductClient","thread_name":"pool-6-thread-3","level":"INFO","level_value":20000}
{"@timestamp":"2019-05-06T12:10:08.510-07:00","@version":"1","message":"<<<<<<<<<<<<<<<<< ProcessingProductSeachResponse() Duration >>>>>>>>>>>>>>>>>> 292","logger_name":"com.ecom.clients.ElasticProductClient","thread_name":"pool-6-thread-3","level":"INFO","level_value":20000}
<<<<<<<<<<<<<<<<< product - ElasticSearchQuery SearchResponse Duration >>>>>>>>>>>>>>>>>> 2587
{"@timestamp":"2019-05-06T12:10:09.251-07:00","@version":"1","message":"<<<<<<<<<<<<<<<<< In-side the getProductItems() SearchResponse Duration >>>>>>>>>>>>>>>>>> 2608","logger_name":"com.ecom.clients.ElasticProductClient","thread_name":"pool-6-thread-1","level":"INFO","level_value":20000}
{"@timestamp":"2019-05-06T12:10:09.704-07:00","@version":"1","message":"<<<<<<<<<<<<<<<<< ProcessingProductSeachResponse() Duration >>>>>>>>>>>>>>>>>> 453","logger_name":"com.ecom.clients.ElasticProductClient","thread_name":"pool-6-thread-1","level":"INFO","level_value":20000}
{"@timestamp":"2019-05-06T12:10:09.704-07:00","@version":"1","message":"product Elastic field requests in thread pool completed, adding to change items","logger_name":"com.ecom.services.ProductSService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}
{"@timestamp":"2019-05-06T12:10:09.705-07:00","@version":"1","message":"No product results found for SAMSUNG.1080","logger_name":"com.ecom.sercives.ProductService","thread_name":"http-nue-8080-exec-2","level":"INFO","level_value":20000,"txId":"42c0-b416-0e06cdfed195"}`Preformatted text`
```

---

<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:** [May 10, 2019, 8:11am UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/4 "2019-05-10T08:11:53Z")

</div>

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

Lots of people read these forums, and many of them will simply skip over a post that is difficult to read, because it's just too large an investment of their time to try and follow a wall of badly formatted text.  
If your goal is to get an answer to your questions, it's in your interest to make it as easy to read and understand as possible.  
Please update your post.

---

<div class="post-metadata">

**Author:** ![aashrithVarikuti](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aashrithvarikuti/32/42539_2.png) [@aashrithVarikuti](https://discuss.elastic.co/u/aashrithVarikuti)\
**Post date:** [May 10, 2019, 5:05pm UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/5 "2019-05-10T17:05:54Z")

</div>

Thank you for info it's help lot.

---

<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:** [May 10, 2019, 5:39pm UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/6 "2019-05-10T17:39:49Z")

</div>

Those are not elasticsearch logs but most likely your application logs.

---

<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:** [June 7, 2019, 5:43pm UTC](https://discuss.elastic.co/t/elasticsearch-high-level-client-response-is-getting-delay/179657/7 "2019-06-07T17:43:35Z")

</div>

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