ElasticSearch High-level client response is getting delay?

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;
     }
}

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

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

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`

Please format your code, logs or configuration files using </> icon as explained in this guide 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:

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.

Thank you for info it's help lot.

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

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