Is Elasticsearch going to sleep after some hours?

We are using Elasticsearch (v7.3.2) for our search solution and we use a Java API to get the search results from Elasticsearch. This is working fine.

In the Test environment we are not using Elasticsearch everyday. What I've noticed now is that if I do a new call to Elasticsearch this request is failing the first time. The next calls are going ok and give results.
It looks like Elasticsearch is going to "sleep mode" after a couple of hours not getting any requests. But I can't find anything about this in the documentation but I found another question here about the same issue.

Strange enough there is no clear answer from Elasticsearch.

So my question, is there some kind of sleep mode for Elasticsearch after some time? Can I disable this ?

I think you are asking about the elasticsearch client and not the server.

I honestly don't know. I wonder if there are some keep alive settings for the underlying http client which can be configured within the low level client.

You can always use the sniffer at it sends every 5 minutes a request to the cluster and see if that changes the behavior. Usage | Java REST Client [7.12] | Elastic

May be others have better ideas :wink:

1 Like

There is not, no.

@warkolm : How do you know? Did you tried it?

I am pretty sure if we had that sort of functionality anywhere in the Elasticsearch code base, it'd be documented. That seems like a large enough gotcha to make it visible on multiple levels.

Ok, but than the qustion, how come my first calls fails after some hours? Nothing to do with Elasticsearch you think ?

There is no sleep mode in Elasticsearch but the operating system can naturally manage processes so it may be at the OS level.

I would strongly suggest it's what David mentioned, so check whatever client you are using and if it has a timeout.

What I'm going to test is to do one call each day from Postman. Let's see how that goes.
Then I'm not using our Java API. Just do a call directly to Elasticsearch.

Do you have a Proxy in the middle by any chance?

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