OTLP/HTTP endpoint
Stack Self-Managed
In addition to the ingestion of metrics data through the bulk API, Elasticsearch offers an alternative way to ingest data through the OpenTelemetry Protocol (OTLP).
The endpoint is available under /_otlp/v1/metrics.
The recommended approach for sending OpenTelemetry Protocol (OTLP) data depends on your deployment:
- ECH and Serverless: Use the Elastic Cloud Managed OTLP Endpoint directly.
- ECE, ECK, and self-managed: Use the Elasticsearch OTLP endpoint described on this page, ideally through an OpenTelemetry Collector in Gateway mode.
For details on the recommended way to set up OpenTelemetry-based data ingestion, refer to the EDOT reference architecture.
Ingesting metrics data using the OTLP endpoint has the following advantages:
- Improved ingestion performance, especially if the data contains many resource attributes.
- Simplified index mapping: there's no need to manually create data streams, index templates, or define dimensions and metrics. Metrics are dynamically mapped using the metadata included in the OTLP requests.
Don't send metrics from applications directly to the Elasticsearch OTLP endpoint, especially if there are many individual applications that periodically send a small amount of metrics. Instead, send data to an OpenTelemetry Collector first. This helps with handling many connections, and with creating bigger batches to improve ingestion performance.
To send data from an OpenTelemetry Collector to the Elasticsearch OTLP endpoint,
use the OTLP/HTTP exporter.
This is an example configuration:
extensions:
  basicauth/elasticsearch:
    client_auth:
      username: <user>
      password: <password>
exporters:
  otlphttp/elasticsearch-metrics:
    endpoint: <es_endpoint>/_otlp
    sending_queue:
      enabled: true
      sizer: bytes
      queue_size: 50_000_000
      block_on_overflow: true
      batch:
        flush_timeout: 1s
        min_size: 1_000_000
        max_size: 4_000_000
    auth:
      authenticator: basicauth/elasticsearch
service:
  extensions: [basicauth/elasticsearch]
  pipelines:
    metrics:
      exporters: [otlphttp/elasticsearch-metrics]
      receivers: ...
		
	- 50MB uncompressed
- 1MB uncompressed
- 4MB uncompressed
The supported options for compression are gzip (default value of the OTLP/HTTP exporter) and none.
To track metrics in your custom application, use the OpenTelemetry language SDK of your choice.
Only encoding: proto is supported, which the OTLP/HTTP exporter uses by default.
By default, metrics are ingested into the metrics-generic.otel-default data stream. You can influence the target data stream by setting specific attributes on your data:
- data_stream.datasetor- data_stream.namespacein attributes, with the following order of precedence: data point attribute -> scope attribute -> resource attribute
- Otherwise, if the scope name contains /receiver/<somereceiver>,data_stream.datasetis set to the receiver name.
- Otherwise, data_stream.datasetfalls back togenericanddata_stream.namespacefalls back todefault.
The target data stream name is constructed as metrics-${data_stream.dataset}.otel-${data_stream.namespace}.
- Only the OTLP metrics endpoint (/_otlp/v1/metrics) is supported. To ingest logs, traces, and profiles, use a distribution of the OpenTelemetry Collector that includes the Elasticsearch exporter, such as the Elastic Distribution of OpenTelemetry (EDOT) Collector.
- Histograms are only supported in delta temporality. Set the temporality preference to delta in your SDKs, or use the cumulativetodeltaprocessor to avoid cumulative histograms to be dropped.
- Exemplars are not supported.