# First search Request on Elasticsearch is slow

**URL:** https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560
**Category:** Elasticsearch
**Created:** [March 13, 2023, 1:50pm UTC](https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560 "2023-03-13T13:50:37Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)
#### Post date: [March 13, 2023, 1:50pm UTC](https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560/1 "2023-03-13T13:50:37Z")

</div>

Hello,

Having an issue on elasticsearch, my first request to search in elastic is slow. Once any term gets searched then it becomes fast. I have researched about this and get to know the solution is to change the index settings for refresh\_interval and index.search.idle.after. I have done the changes and changed the idle after settings to:

```auto
{
  "settings": {
    "index.search.idle.after": "3600s" 
  }
}

```

and refresh\_interval to:

```auto
{
  "index": {
    "refresh_interval": "3600s" 
  }
}

```

But my problem is not resolved.

Note that I am searching on multiple indices. Also I have updated the same settings for all indices.

---

<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: [March 13, 2023, 6:09pm UTC](https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560/2 "2023-03-13T18:09:49Z")

</div>

You set to refresh the index every hour. You should may be lower this to 1s.

But, I'd not change those settings.

Instead, when you first start your application, just send some random requests to the indices so this will warmup the cluster.

If this can not fit your use case, could you explain what are you using Elasticsearch for?

---

<div class="post-metadata">

### Author: ![Rakhshunda\_Noorein\_J](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakhshunda_noorein_j/32/99407_2.png) [@Rakhshunda\_Noorein\_J](https://discuss.elastic.co/u/Rakhshunda_Noorein_J)
#### Post date: [March 14, 2023, 6:11am UTC](https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560/3 "2023-03-14T06:11:36Z")

</div>

> [@dadoonet](#):
>
> application

after some time when the cluster is idle then first search is taking time. That's why I change the idle.after setting.  
I am using elasticsearch for text search purpose.

It is not a proper that every we need to warm up the cluster so it works properly..

---

<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: [March 14, 2023, 11:41am UTC](https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560/4 "2023-03-14T11:41:33Z")

</div>

You could also fire a request every x minutes to keep the cluster warm.

---

<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: [April 11, 2023, 11:41am UTC](https://discuss.elastic.co/t/first-search-request-on-elasticsearch-is-slow/327560/5 "2023-04-11T11:41:35Z")

</div>

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