Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[exporter/elasticsearch] Bulk indexer error: an id must be provided if version type or value are set #33139

Open
lmssy opened this issue May 21, 2024 · 6 comments
Labels
bug Something isn't working exporter/elasticsearch needs triage New item requiring triage

Comments

@lmssy
Copy link

lmssy commented May 21, 2024

Component(s)

exporter/elasticsearch

What happened?

Description

I'm trying to export trace & span to elasticsearch v7, I config collector just follow the document https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/elasticsearchexporter
but in collector's log report below error, there is no index created in elasticsearch. please help to check, thx.

image

Steps to Reproduce

Expected Result

Actual Result

Collector version

0.100.0

Environment information

Environment

OpenTelemetry Collector configuration

extensions:
  health_check:
receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
exporters:
  file:
    path: /agent.json
  debug:
  elasticsearch/trace:
    endpoints: [http://my-elastich-host:9200]
    traces_index: trace_index
    user: xxx
    password: xxx
processors:
  batch/trace:
  memory_limiter/trace:
    limit_mib: 3000
    spike_limit_mib: 600
    check_interval: 5s
  tail_sampling:
    decision_wait: 10s
    policies:
      - name: slow_calls
        type: latency
        latency:
          threshold_ms: 5000
      - name: error_otel_status
        type: status_code
        status_code:
          status_codes:
            - ERROR
      - name: error_http_status
        type: numeric_attribute
        numeric_attribute:
            key: http.status_code
            min_value: 500
      - name: keep_sampled_success
        type: and
        and:
          and_sub_policy:
            - name: drop_noisy_traces_url
              type: string_attribute
              string_attribute:
                key: http.url
                values:
                  - \/metrics
                  - opentelemetry\.proto
                  - favicon\.ico
                  - \/health
                enabled_regex_matching: true
                invert_match: true
            - name: keep_percentage
              type: probabilistic
              probabilistic:
                sampling_percentage: 100
service:
  extensions: [health_check]
  pipelines:
    traces:
      receivers: [otlp]
      processors: [memory_limiter/trace,tail_sampling,batch/trace]
      exporters: [debug,file,elasticsearch/trace]

Log output

2024-05-21T13:48:18.897+0800	error	elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150	Bulk indexer error: flush: [400 Bad Request] {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"},"status":400}	{"kind": "exporter", "data_type": "traces", "name": "elasticsearch/trace"}
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter.newBulkIndexer.func1
	github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150
github.com/elastic/go-elasticsearch/v7/esutil.(*bulkIndexer).init.func1
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:324
2024-05-21T13:48:18.907+0800	error	elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150	Bulk indexer error: flush: [400 Bad Request] {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"},"status":400}	{"kind": "exporter", "data_type": "traces", "name": "elasticsearch/trace"}
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter.newBulkIndexer.func1
	github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150
github.com/elastic/go-elasticsearch/v7/esutil.(*worker).flush
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:568
github.com/elastic/go-elasticsearch/v7/esutil.(*bulkIndexer).init.func1
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:321
2024-05-21T13:48:18.907+0800	error	elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150	Bulk indexer error: flush: [400 Bad Request] {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"},"status":400}	{"kind": "exporter", "data_type": "traces", "name": "elasticsearch/trace"}
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter.newBulkIndexer.func1
	github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150
github.com/elastic/go-elasticsearch/v7/esutil.(*bulkIndexer).init.func1
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:324
2024-05-21T13:48:18.968+0800	error	elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150	Bulk indexer error: flush: [400 Bad Request] {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"},"status":400}	{"kind": "exporter", "data_type": "traces", "name": "elasticsearch/trace"}
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter.newBulkIndexer.func1
	github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150
github.com/elastic/go-elasticsearch/v7/esutil.(*worker).flush
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:568
github.com/elastic/go-elasticsearch/v7/esutil.(*bulkIndexer).init.func1
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:321
2024-05-21T13:48:18.968+0800	error	elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150	Bulk indexer error: flush: [400 Bad Request] {"error":{"root_cause":[{"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"}],"type":"action_request_validation_exception","reason":"Validation Failed: 1: an id must be provided if version type or value are set;2: an id must be provided if version type or value are set;"},"status":400}	{"kind": "exporter", "data_type": "traces", "name": "elasticsearch/trace"}
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter.newBulkIndexer.func1
	github.com/open-telemetry/opentelemetry-collector-contrib/exporter/elasticsearchexporter@v0.100.0/elasticsearch_bulk.go:150
github.com/elastic/go-elasticsearch/v7/esutil.(*bulkIndexer).init.func1
	github.com/elastic/go-elasticsearch/v7@v7.17.10/esutil/bulk_indexer.go:324
2024-05-21T13:48:19.010+0800	info	TracesExporter	{"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
2024-05-21T13:48:21.016+0800	info	TracesExporter	{"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 2, "spans": 2}
2024-05-21T13:48:24.026+0800	info	TracesExporter	{"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}
2024-05-21T13:48:31.045+0800	info	TracesExporter	{"kind": "exporter", "data_type": "traces", "name": "debug", "resource spans": 1, "spans": 1}

Additional context

No response

@lmssy lmssy added bug Something isn't working needs triage New item requiring triage labels May 21, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@lmssy
Copy link
Author

lmssy commented May 29, 2024

anyone can take a look for this issue?

Copy link
Contributor

This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@medorock25
Copy link

does anyone knows the solution ?

@medorock25
Copy link

@lmssy
Have you solved this issue ?

@carsonip
Copy link
Contributor

carsonip commented Sep 2, 2024

Sorry for the late reply. I am unable to reproduce the issue with v7.17.23 Elasticsearch and v0.108.0 elasticsearchexporter with a simpler config:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318
exporters:
  debug:
  elasticsearch/trace:
    endpoints: [https://redacted.elastic-cloud.com]
    traces_index: trace_index
    user: redacted
    password: redacted
service:
  pipelines:
    traces:
      receivers: [otlp]
      processors: []
      exporters: [debug,elasticsearch/trace]

Questions

  • Do you get the same error without processors memory_limiter/trace,tail_sampling,batch/trace?
  • What kind of otlp payload are you sending to the collector? Does this happen with a very simple test span?
  • Which exact v7 version are you using?
  • Are there 0 documents indexed into Elasticsearch despite the error logs? Do you notice a pattern within the dropped documents, if there are any?
  • Are you somehow assigning _id or _version to the documents?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working exporter/elasticsearch needs triage New item requiring triage
Projects
None yet
Development

No branches or pull requests

3 participants