Failed to sample – How to solve this Elasticsearch error

Opster Team

Aug-23, Version: 6.8-7.17

Briefly, this error occurs when Elasticsearch is unable to collect a sample of data from the index. This could be due to a variety of reasons such as insufficient memory, heavy load on the cluster, or a network issue. To resolve this, you can try increasing the heap size, optimizing your queries to reduce load, or checking your network connectivity. Additionally, ensure that your Elasticsearch cluster is properly configured and that there are no issues with the underlying hardware.

This guide will help you check for common problems that cause the log ” failed to sample ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: client.

Log Context

Log “failed to sample” classname is
We extracted the following from Elasticsearch source code for those seeking an in-depth context :

                if (closed == false) {
                    nodesSamplerCancellable = threadPool.schedule(this; nodesSamplerInterval; ThreadPool.Names.GENERIC);
            } catch (Exception e) {
                logger.warn("failed to sample"; e);

    class SimpleNodeSampler extends NodeSampler {