Skip to main content

Elasticsearch

Plugin: go.d.plugin Module: elasticsearch

Overview

This collector monitors the performance and health of the Elasticsearch cluster.

It uses Cluster APIs to collect metrics.

Used endpoints:

EndpointDescriptionAPI
/Node info
/_nodes/statsNodes metricsNodes stats API
/_nodes/_local/statsLocal node metricsNodes stats API
/_cluster/healthCluster health statsCluster health API
/_cluster/statsCluster metricsCluster stats API

This collector is supported on all platforms.

This collector supports collecting metrics from multiple instances of this integration, including remote instances.

Elasticsearch can be monitored further using the following other integrations:

Default Behavior

Auto-Detection

By default, it detects instances running on localhost by attempting to connect to port 9200:

Limits

By default, this collector monitors only the node it is connected to. To monitor all cluster nodes, set the cluster_mode configuration option to yes.

Performance Impact

The default configuration for this integration is not expected to impose a significant performance impact on the system.

Setup

You can configure the elasticsearch collector in two ways:

MethodBest forHow to
UIFast setup without editing filesGo to Nodes → Configure this node → Collectors → Jobs, search for elasticsearch, then click + to add a job.
FileIf you prefer configuring via file, or need to automate deployments (e.g., with Ansible)Edit go.d/elasticsearch.conf and add a job.
important

UI configuration requires paid Netdata Cloud plan.

Prerequisites

No action required.

Configuration

Options

The following options can be defined globally: update_every, autodetection_retry.

Config options
GroupOptionDescriptionDefaultRequired
Collectionupdate_everyData collection interval (seconds).5no
autodetection_retryAutodetection retry interval (seconds). Set 0 to disable.0no
TargeturlTarget endpoint URL.http://127.0.0.1:9200yes
timeoutHTTP request timeout (seconds).2no
Metrics Selectioncluster_modeCollect metrics for all nodes in the cluster (yes) or only the local node (no).nono
collect_node_statsCollect node metrics.yesno
collect_cluster_healthCollect cluster health metrics.yesno
collect_cluster_statsCollect cluster stats metrics.yesno
collect_indices_statsCollect index metrics.nono
HTTP AuthusernameUsername for Basic HTTP authentication.no
passwordPassword for Basic HTTP authentication.no
bearer_token_filePath to a file containing a bearer token (used for Authorization: Bearer).no
TLStls_skip_verifySkip TLS certificate and hostname verification (insecure).nono
tls_caPath to CA bundle used to validate the server certificate.no
tls_certPath to client TLS certificate (for mTLS).no
tls_keyPath to client TLS private key (for mTLS).no
Proxyproxy_urlHTTP proxy URL.no
proxy_usernameUsername for proxy Basic HTTP authentication.no
proxy_passwordPassword for proxy Basic HTTP authentication.no
RequestmethodHTTP method to use.GETno
bodyRequest body (e.g., for POST/PUT).no
headersAdditional HTTP headers (one per line as key: value).no
not_follow_redirectsDo not follow HTTP redirects.nono
force_http2Force HTTP/2 (including h2c over TCP).nono
Functionsfunctions.top_queries.disabledDisable the top-queries function.nono
functions.top_queries.timeoutQuery timeout (seconds). Uses collector timeout if not set.no
functions.top_queries.limitMaximum number of queries to return.500no
Virtual NodevnodeAssociates this data collection job with a Virtual Node.no

via UI

Configure the elasticsearch collector from the Netdata web interface:

  1. Go to Nodes.
  2. Select the node where you want the elasticsearch data-collection job to run and click the (Configure this node). That node will run the data collection.
  3. The Collectors → Jobs view opens by default.
  4. In the Search box, type elasticsearch (or scroll the list) to locate the elasticsearch collector.
  5. Click the + next to the elasticsearch collector to add a new job.
  6. Fill in the job fields, then click Test to verify the configuration and Submit to save.
    • Test runs the job with the provided settings and shows whether data can be collected.
    • If it fails, an error message appears with details (for example, connection refused, timeout, or command execution errors), so you can adjust and retest.

via File

The configuration file name for this integration is go.d/elasticsearch.conf.

The file format is YAML. Generally, the structure is:

update_every: 1
autodetection_retry: 0
jobs:
- name: some_name1
- name: some_name2

You can edit the configuration file using the edit-config script from the Netdata config directory.

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config go.d/elasticsearch.conf
Examples
Basic single node mode

A basic example configuration.

jobs:
- name: local
url: http://127.0.0.1:9200

Cluster mode

Cluster mode example configuration.

Config
jobs:
- name: local
url: http://127.0.0.1:9200
cluster_mode: yes

HTTP authentication

Basic HTTP authentication.

Config
jobs:
- name: local
url: http://127.0.0.1:9200
username: username
password: password

HTTPS with self-signed certificate

Elasticsearch with enabled HTTPS and self-signed certificate.

Config
jobs:
- name: local
url: https://127.0.0.1:9200
tls_skip_verify: yes

Multi-instance

Note: When you define multiple jobs, their names must be unique.

Collecting metrics from local and remote instances.

Config
jobs:
- name: local
url: http://127.0.0.1:9200

- name: remote
url: http://192.0.2.1:9200

Alerts

The following alerts are available:

Alert nameOn metricDescription
elasticsearch_node_indices_search_time_query elasticsearch.node_indices_search_timesearch performance is degraded, queries run slowly.
elasticsearch_node_indices_search_time_fetch elasticsearch.node_indices_search_timesearch performance is degraded, fetches run slowly.
elasticsearch_cluster_health_status_red elasticsearch.cluster_health_statuscluster health status is red.
elasticsearch_cluster_health_status_yellow elasticsearch.cluster_health_statuscluster health status is yellow.
elasticsearch_node_index_health_red elasticsearch.node_index_healthnode index $label:index health status is red.

Metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

Per node

These metrics refer to the cluster node.

Labels:

LabelDescription
cluster_nameName of the cluster. Based on the Cluster name setting.
node_nameHuman-readable identifier for the node. Based on the Node name setting.
hostNetwork host for the node, based on the Network host setting.

Metrics:

MetricDescriptionDimensionsUnit
elasticsearch.node_indices_indexingIndexing Operationsindexoperations/s
elasticsearch.node_indices_indexing_currentIndexing Operations Currentindexoperations
elasticsearch.node_indices_indexing_timeTime Spent On Indexing Operationsindexmilliseconds
elasticsearch.node_indices_searchSearch Operationsqueries, fetchesoperations/s
elasticsearch.node_indices_search_currentSearch Operations Currentqueries, fetchesoperations
elasticsearch.node_indices_search_timenode_indices_search_timequeries, fetchesmilliseconds
elasticsearch.node_indices_refreshRefresh Operationsrefreshoperations/s
elasticsearch.node_indices_refresh_timeTime Spent On Refresh Operationsrefreshmilliseconds
elasticsearch.node_indices_flushFlush Operationsflushoperations/s
elasticsearch.node_indices_flush_timeTime Spent On Flush Operationsflushmilliseconds
elasticsearch.node_indices_fielddata_memory_usageFielddata Cache Memory Usageusedbytes
elasticsearch.node_indices_fielddata_evictionsFielddata Evictionsevictionsoperations/s
elasticsearch.node_indices_segments_countSegments Countsegmentssegments
elasticsearch.node_indices_segments_memory_usage_totalSegments Memory Usage Totalusedbytes
elasticsearch.node_indices_segments_memory_usageSegments Memory Usageterms, stored_fields, term_vectors, norms, points, doc_values, index_writer, version_map, fixed_bit_setbytes
elasticsearch.node_indices_translog_operationsTranslog Operationstotal, uncommittedoperations
elasticsearch.node_indices_translog_sizeTranslog Sizetotal, uncommittedbytes
elasticsearch.node_file_descriptorsProcess File Descriptorsopenfd
elasticsearch.node_jvm_heapJVM Heap Percentage Currently in Useinusepercentage
elasticsearch.node_jvm_heap_bytesJVM Heap Commit And Usagecommitted, usedbytes
elasticsearch.node_jvm_buffer_pools_countJVM Buffer Pools Countdirect, mappedpools
elasticsearch.node_jvm_buffer_pool_direct_memoryJVM Buffer Pool Direct Memorytotal, usedbytes
elasticsearch.node_jvm_buffer_pool_mapped_memoryJVM Buffer Pool Mapped Memorytotal, usedbytes
elasticsearch.node_jvm_gc_countJVM Garbage Collectionsyoung, oldgc/s
elasticsearch.node_jvm_gc_timeJVM Time Spent On Garbage Collectionsyoung, oldmilliseconds
elasticsearch.node_thread_pool_queuedThread Pool Queued Threads Countgeneric, search, search_throttled, get, analyze, write, snapshot, warmer, refresh, listener, fetch_shard_started, fetch_shard_store, flush, force_merge, managementthreads
elasticsearch.node_thread_pool_rejectedThread Pool Rejected Threads Countgeneric, search, search_throttled, get, analyze, write, snapshot, warmer, refresh, listener, fetch_shard_started, fetch_shard_store, flush, force_merge, managementthreads
elasticsearch.node_cluster_communication_packetsCluster Communicationreceived, sentpps
elasticsearch.node_cluster_communication_trafficCluster Communication Bandwidthreceived, sentbytes/s
elasticsearch.node_http_connectionsHTTP Connectionsopenconnections
elasticsearch.node_breakers_tripsCircuit Breaker Trips Countrequests, fielddata, in_flight_requests, model_inference, accounting, parenttrips/s

Per cluster

These metrics refer to the cluster.

Labels:

LabelDescription
cluster_nameName of the cluster. Based on the Cluster name setting.

Metrics:

MetricDescriptionDimensionsUnit
elasticsearch.cluster_health_statusCluster Statusgreen, yellow, redstatus
elasticsearch.cluster_number_of_nodesCluster Nodes Countnodes, data_nodesnodes
elasticsearch.cluster_shards_countCluster Shards Countactive_primary, active, relocating, initializing, unassigned, delayed_unaasignedshards
elasticsearch.cluster_pending_tasksCluster Pending Taskspendingtasks
elasticsearch.cluster_number_of_in_flight_fetchCluster Unfinished Fetchesin_flight_fetchfetches
elasticsearch.cluster_indices_countCluster Indices Countindicesindices
elasticsearch.cluster_indices_shards_countCluster Indices Shards Counttotal, primaries, replicationshards
elasticsearch.cluster_indices_docs_countCluster Indices Docs Countdocsdocs
elasticsearch.cluster_indices_store_sizeCluster Indices Store Sizesizebytes
elasticsearch.cluster_indices_query_cacheCluster Indices Query Cachehit, missevents/s
elasticsearch.cluster_nodes_by_role_countCluster Nodes By Role Countcoordinating_only, data, data_cold, data_content, data_frozen, data_hot, data_warm, ingest, master, ml, remote_cluster_client, voting_onlynodes

Per index

These metrics refer to the index.

Labels:

LabelDescription
cluster_nameName of the cluster. Based on the Cluster name setting.
indexName of the index.

Metrics:

MetricDescriptionDimensionsUnit
elasticsearch.node_index_healthIndex Healthgreen, yellow, redstatus
elasticsearch.node_index_shards_countIndex Shards Countshardsshards
elasticsearch.node_index_docs_countIndex Docs Countdocsdocs
elasticsearch.node_index_store_sizeIndex Store Sizestore_sizebytes

Live Data

This collector exposes real-time functions for interactive troubleshooting in the Live tab.

Top Queries

Retrieves currently running search tasks from the Elasticsearch Tasks API.

This function queries the /_tasks endpoint filtered for search actions (*search), providing a real-time snapshot of all active search operations across all nodes in the cluster.

Use cases:

  • Identify long-running search queries that may be impacting cluster performance
  • Monitor active search workload distribution across cluster nodes
  • Debug slow or stuck search operations in real-time
AspectDescription
NameElasticsearch:top-queries
Require Cloudyes
PerformanceQueries the /_tasks API filtered for search actions:
• Lightweight operation with minimal cluster overhead
• Returns only currently active search tasks, typically a small result set
SecurityTask descriptions may contain query details including potentially sensitive information:
• Index names and search patterns
• Query terms and filter values
• Access should be restricted to authorized personnel only
AvailabilityAvailable when:
• The collector has successfully connected to Elasticsearch/OpenSearch
• The user has monitor or manage cluster privileges
• Returns HTTP 503 if collector is still initializing
• Returns HTTP 500 if the Tasks API query fails
• Returns HTTP 504 if the query times out

Prerequisites

Ensure access to Tasks API

The user must have appropriate privileges to access the Tasks API.

  1. For secured clusters, grant the monitor or manage cluster privilege:

    {
    "cluster": ["monitor"]
    }
  2. Verify access to the Tasks API:

    curl -u user:password "http://localhost:9200/_tasks?actions=*search"
info
  • The Tasks API returns only currently running tasks; completed tasks are not stored
  • Search tasks can be cancelled using POST /_tasks/{task_id}/_cancel if they are cancellable
  • Works with both Elasticsearch and OpenSearch clusters

Parameters

ParameterTypeDescriptionRequiredDefaultOptions
Filter ByselectSelect the primary sort column. Options include running time, start time, and task ID. Defaults to running time to show longest-running searches first.yesrunningTime

Returns

Real-time snapshot of currently executing search tasks across all cluster nodes. Each row represents a single active search operation.

ColumnTypeUnitVisibilityDescription
Task IDstringhiddenUnique identifier for the task in format nodeId:taskId. Can be used with the Task Management API to cancel long-running tasks.
Node IDstringInternal identifier of the node executing this search task.
Node NamestringHuman-readable name of the node executing the search. Useful for identifying workload distribution across the cluster.
ActionstringThe search action being performed (e.g., indices:data/read/search). Indicates the type of search operation.
TypestringhiddenTask type classification (typically transport for search tasks).
DescriptionstringDetailed description of the search task including indices being searched and query details. Truncated to 4096 characters.
Start TimetimestampTimestamp when the search task started executing.
Running TimedurationmillisecondsTime elapsed since the search started. High values indicate long-running searches that may need investigation or cancellation.
CancellablebooleanhiddenWhether the task supports cancellation via the Task Management API.
CancelledbooleanhiddenWhether a cancellation request has been issued for this task.

Troubleshooting

Debug Mode

Important: Debug mode is not supported for data collection jobs created via the UI using the Dyncfg feature.

To troubleshoot issues with the elasticsearch collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    cd /usr/libexec/netdata/plugins.d/
  • Switch to the netdata user.

    sudo -u netdata -s
  • Run the go.d.plugin to debug the collector:

    ./go.d.plugin -d -m elasticsearch

    To debug a specific job:

    ./go.d.plugin -d -m elasticsearch -j jobName

Getting Logs

If you're encountering problems with the elasticsearch collector, follow these steps to retrieve logs and identify potential issues:

  • Run the command specific to your system (systemd, non-systemd, or Docker container).
  • Examine the output for any warnings or error messages that might indicate issues. These messages should provide clues about the root cause of the problem.

System with systemd

Use the following command to view logs generated since the last Netdata service restart:

journalctl _SYSTEMD_INVOCATION_ID="$(systemctl show --value --property=InvocationID netdata)" --namespace=netdata --grep elasticsearch

System without systemd

Locate the collector log file, typically at /var/log/netdata/collector.log, and use grep to filter for collector's name:

grep elasticsearch /var/log/netdata/collector.log

Note: This method shows logs from all restarts. Focus on the latest entries for troubleshooting current issues.

Docker Container

If your Netdata runs in a Docker container named "netdata" (replace if different), use this command:

docker logs netdata 2>&1 | grep elasticsearch

Do you have any feedback for this page? If so, you can open a new issue on our netdata/learn repository.