The OpenTelemetry Collector Elasticsearch exporter looks simple until the first oversized bulk request hits a proxy limit. The Collector has already accepted telemetry, the exporter tries to send it, and the backend path answers with HTTP 413. At that point, what matters is whether your exporter queue, batch size, retry policy, and monitoring tell you what happened before telemetry disappears from the backend.
This guide covers the OpenTelemetry Collector Elasticsearch exporter as a production component: a minimal config, byte-based queue batching, retry behavior, migration from older batching fields, HTTP 413 troubleshooting, and the monitoring signals that show whether accepted telemetry reached Elasticsearch.
What the OpenTelemetry Elasticsearch exporter does
The Elasticsearch exporter is the Collector component that sends telemetry from a Collector pipeline to Elasticsearch. The upstream exporter README says it supports logs, metrics, traces, and profiles. The same README lists traces, logs, and metrics as beta stability, and profiles as development stability.
Keep that scope narrow. The exporter decides how the Collector turns telemetry into Elasticsearch bulk indexing requests. It does not tune shards, lifecycle policies, index templates, or http.max_content_length for you. Those are Elasticsearch-side concerns. Your Collector config still needs to respect the smallest request limit between the Collector and the Elasticsearch HTTP endpoint, including proxies and gateways in the path.
Three exporter concerns matter most in production:
| Concern | What it controls | Why it matters |
|---|---|---|
| Routing | Which index or data stream receives each signal | Wrong routing can make telemetry hard to find or mix signals unexpectedly. |
| Queueing | How much work waits before export | A small queue fills quickly during backend or proxy failures. |
| Batching | How large each outgoing request can become | Oversized bulk requests can fail with HTTP 413. |
If you are still designing the Collector topology, start with the OpenTelemetry Collector architecture guide before tuning this exporter. The exporter is only the final hop in a pipeline.
Minimal working Elasticsearch exporter config
Start with the smallest config that proves end-to-end delivery. The example below receives OTLP and exports logs, metrics, and traces to Elasticsearch. It leaves the batch processor out on purpose because the Elasticsearch exporter already enables sending_queue batching by default.
receivers: otlp: protocols: grpc: endpoint: 0.0.0.0:4317 http: endpoint: 0.0.0.0:4318
exporters: elasticsearch: endpoints: - https://elasticsearch.example.internal:9200 auth: authenticator: basicauth/elasticsearch timeout: 90s tls: ca_file: /etc/otel/certs/ca.pem
extensions: basicauth/elasticsearch: client_auth: username: ${env:ELASTICSEARCH_USERNAME} password: ${env:ELASTICSEARCH_PASSWORD}
service: extensions: [basicauth/elasticsearch] pipelines: logs: receivers: [otlp] exporters: [elasticsearch] metrics: receivers: [otlp] exporters: [elasticsearch] traces: receivers: [otlp] exporters: [elasticsearch]The exporter supports common Collector HTTP and TLS settings through the Collector config model. Its README shows timeout: 90s as the default HTTP request timeout. That timeout is per request and independent between HTTP retries.
Do not paste this directly into production without version validation. Collector distributions differ, and auth extensions depend on the binary you run. Validate with your Collector binary before rollout:
otelcol-contrib validate --config /etc/otelcol-contrib/config.yamlFor routing, the exporter README documents static index settings such as logs_index, metrics_index, and traces_index, plus dynamic routing from attributes such as elasticsearch.index and data stream fields. Pick one routing model early. Mixing static and dynamic routing without a naming convention makes later troubleshooting harder because the same service can land in different indices.
Batching and queue settings that control request size
The Elasticsearch exporter uses exporterhelper sending_queue settings for queueing and batching. The exporter README shows this default queue and batch shape:
sending_queue: enabled: true sizer: requests num_consumers: 10 queue_size: 10 batch: flush_timeout: 10s min_size: 1e+6 # 1MB max_size: 5e+6 # 5MB sizer: bytesTwo details in that default are easy to miss. First, the parent queue uses sizer: requests, so queue_size: 10 means ten queued requests, not ten megabytes. Second, the batch uses sizer: bytes and max_size: 5e+6, so outgoing batches are shaped by pdata byte size before they become Elasticsearch bulk request bodies.
That difference matters because the encoded bulk request can be larger than the pdata size used for batching. Leave headroom below the smallest limit in your path. If a proxy rejects requests above 10 MB, setting max_size to 10 MB is not conservative. A lower value gives room for NDJSON encoding, headers, and variance across telemetry records.
A production starting point looks like this:
exporters: elasticsearch: endpoints: - https://elasticsearch.example.internal:9200 sending_queue: enabled: true sizer: requests num_consumers: 8 queue_size: 50 batch: flush_timeout: 5s min_size: 524288 max_size: 2097152 sizer: bytesThis example is not a universal recommendation. It shows the direction: set a byte-based max_size with headroom, decide how much request backlog the queue can hold, and keep the queue size large enough for short backend interruptions. Then load test with telemetry that resembles production, not with tiny synthetic spans.
Avoid adding the batch processor to the minimal config just because many Collector examples include one. The exporterhelper README documents a startup warning when a pipeline contains both a batch processor and an exporter exposing sending queue batching with batching enabled. Use both only when you can explain what each layer is doing.
For Elasticsearch request sizing, the exporter queue batch is the place to set max_size. The batch processor can still be useful elsewhere in a Collector topology, but it is not the setting that protects the Elasticsearch bulk request at the exporter boundary.
Retry behavior and duplicate indexing risk
The Elasticsearch exporter has its own retry block for bulk requests. It does not use the generic retry_on_failure setting that many other Collector exporters share, so retry config copied from another exporter does not apply here. The exporter README documents these defaults:
exporters: elasticsearch: retry: enabled: true max_retries: 2 initial_interval: 100ms max_interval: 1m retry_on_status: [400, 401, 403, 404, 409, 429, 500, 502, 503, 504] retry_on_document_status: [429, 500, 502, 503, 504]retry_on_status lists the HTTP status codes that retry the whole bulk request. 413 is not on the default list, so an oversized request fails on the first response instead of being retried. Adding 413 to that list would not help: a retry sends the same payload, and the same limit rejects it again. retry_on_document_status covers a different case, where individual documents fail inside a bulk response that otherwise succeeded.
The README also warns that retrying an HTTP client timeout or a 500, 502, 503, or 504 response can index the same documents twice, when the first _bulk request was applied and its response was lost. The default delivery guarantee is at-least-once.
Use retry for failures that have a chance to clear. Use batch sizing for failures caused by fixed size limits.
If duplicate indexing is unacceptable for a signal, test the failure mode with your document IDs, mapping mode, and index strategy. Retries give you at-least-once delivery, not exactly-once indexing.
Migrating from removed flush and num_workers settings
Older Elasticsearch exporter configs used exporter-specific batching knobs such as flush and num_workers. The current exporter README says the default sending queue settings were chosen to be close to the previous built-in batching feature. In current configs, move that intent into sending_queue.
Use this mapping as a migration checklist:
| Older intent | Current place to express it | Notes |
|---|---|---|
| Flush after a time window | sending_queue.batch.flush_timeout | Shorter values reduce wait time but can increase request count. |
| Flush after a batch size | sending_queue.batch.min_size and max_size | Use sizer: bytes when request size is the concern. |
| Limit request size | sending_queue.batch.max_size | Leave headroom below proxy and Elasticsearch limits. |
| Export concurrency | sending_queue.num_consumers | More consumers can increase parallel bulk requests. |
| Queue capacity | sending_queue.queue_size with parent sizer | In the Elasticsearch default, this is measured in requests. |
Do the migration in two steps. First, validate that the Collector accepts the new config. Then compare export rate, queue size, and backend indexing behavior under normal traffic before changing batch size or concurrency. A config that parses can still overload Elasticsearch if it increases parallel bulk writes.
If you run multiple Collector versions during a rollout, keep a version-specific config note with the deployment. Give each Collector binary the config shape it validates instead of switching every deployment at once.
Troubleshoot HTTP 413 and oversized bulk requests
HTTP 413 means the request is too large for something in the path. That something may be Elasticsearch, an ingress controller, a service mesh proxy, a gateway, or another HTTP layer in front of the cluster. The Collector sees an export failure, but the fix often starts with finding which hop rejected the request.
As of December 3, 2026, upstream issue #45834 is still open, with no fix merged. It describes missing HTTP 413 handling in the Elasticsearch exporter and the risk of data loss when oversized requests are not split to fit backend limits. Until that changes, byte-sized sending_queue batching with headroom is the practical guard, keeping in mind that pdata size and encoded bulk request size can differ.
Treat that as an active upstream thread, not a fixed behavior to rely on. Recheck the issue and your Collector release notes before upgrading.
When you see 413s, run this sequence:
- Confirm the status code source. Check Collector logs, proxy logs, ingress logs, and Elasticsearch HTTP logs.
- Find the smallest configured request limit on the path. Include proxies, not only Elasticsearch.
- Lower
sending_queue.batch.max_sizebelow that limit with headroom for encoding. - Reduce
flush_timeoutonly if you need faster flushing during the incident. - Roll the config safely across Collectors.
- Watch queue size, queue capacity, exporter failures, and accepted-versus-sent deltas.
- Keep the lower limit until a load test proves the next value is safe.
Do not depend on retry to solve this class of incident. Retry can preserve a request while the backend is temporarily unhealthy. It does not split a request that is too large for the same path.
Persistent queues help with Collector restarts and short backend interruptions, but they can also replay the same oversized request after restart. If the request is rejected because of size, persistent storage preserves the backlog; it does not rewrite the payload. Our OTel Collector monitoring guide covers queue metrics, persistent queue recovery, and accepted-versus-sent checks in more detail.
Monitor exporter failures and data gaps
Monitor the Elasticsearch exporter as a data-delivery component, not as a black-box HTTP client. The useful question is: how much telemetry did the Collector accept, and how much reached Elasticsearch?
Watch these signals together:
| Signal | What it tells you |
|---|---|
| Receiver accepted counts | Telemetry entered the Collector. |
| Exporter sent counts | Telemetry left the Collector for Elasticsearch. |
| Exporter send failures | Requests failed after reaching exporter logic. |
| Exporter enqueue failures | Data did not enter the sending queue. |
| Queue size and capacity | Backlog is building or draining. |
| Collector logs | Status codes, queue errors, config warnings, and startup warnings. |
| Proxy and Elasticsearch HTTP logs | Which hop returned 413 or timed out. |
Use metric names from your running Collector version. Collector internal telemetry names and stability can change, and dashboards copied from another version may miss the signal you need. The monitoring pattern is more stable than any single metric name: compare accepted telemetry with sent telemetry, then explain the gap with queue and failure signals.
For broader exporter debugging, our OTel exporter guide separates endpoint, authentication, protocol, and pipeline health checks. For scaling pressure, the OpenTelemetry Collector scaling guide covers memory, queues, and exporter settings that become visible only under load.
If you send Collector telemetry to Last9, put Collector metrics, Collector logs, and backend delivery symptoms in the same incident view, so exporter send failures and delivery gaps show up before a quiet Elasticsearch dashboard does.
Pre-upgrade checklist
Before you upgrade the Collector or change the Elasticsearch exporter config, check the moving parts that affect this guide:
- Recheck upstream issue #45834 and any linked implementation work.
- Read the Elasticsearch exporter README for your target Collector contrib version.
- Confirm whether
flushornum_workersexists in any deployed config. - Validate the new config with the exact Collector binary you deploy.
- Load test with representative logs, spans, metrics, and resource attributes.
- Record the request limit for Elasticsearch and every proxy in front of it.
- Keep a rollback value for
sending_queue.batch.max_size.
The safest upgrade is boring: avoid surprise batching layers, unknown proxy limits, and dashboards that only watch the backend after the Collector has already dropped or stalled data.
FAQ
What does the OpenTelemetry Elasticsearch exporter do?
The OpenTelemetry Elasticsearch exporter is a Collector exporter that sends logs, metrics, traces, and profiles from Collector pipelines to Elasticsearch. Its current README marks traces, logs, and metrics as beta and profiles as development stability.
How do I configure the OpenTelemetry Collector Elasticsearch exporter?
Start with an OTLP receiver, the elasticsearch exporter endpoint, authentication or TLS settings for your cluster, and a pipeline that sends the relevant signals to that exporter. Use sending_queue batching on the exporter instead of adding a batch processor to the minimal example.
What max_size should I set for Elasticsearch exporter batches?
Start below the smallest proxy or Elasticsearch request limit in the path. The exporter README shows a default sending_queue.batch.max_size of 5MB, measured on pdata bytes, so leave headroom for the encoded bulk request.
Does retry prevent data loss from HTTP 413 responses?
No. The Elasticsearch exporter retry settings do not include 413 by default, and a retry would resend the same oversized payload anyway. Lower sending_queue.batch.max_size instead. The exporter README also warns that retrying 5xx responses or timeouts can index documents twice.
Should I use the batch processor or sending_queue batching?
For Elasticsearch request sizing, prefer sending_queue batching on the exporter because that is where max_size controls request batches. Exporterhelper documents a startup warning when a pipeline has both a batch processor and exporter queue batching enabled.
How do I monitor whether Elasticsearch exporter data was dropped?
Watch exporter send failures, enqueue failures, queue size, queue capacity, Collector logs, and the gap between receiver-accepted telemetry and exporter-sent telemetry. Use metric names from your Collector version because names can change.
