diff --git a/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml b/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml index 3a1ba435b8f1f..fda2e8a756e5e 100644 --- a/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml +++ b/x-pack/plugin/otel-data/src/main/resources/component-templates/traces-otel@mappings.yaml @@ -41,6 +41,13 @@ template: unit: nanos dropped_events_count: type: long + attributes: + type: passthrough + dynamic: true + priority: 20 + properties: + elastic.profiler_stack_trace_ids: + type: counted_keyword links: synthetic_source_keep: arrays properties: diff --git a/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml b/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml index 82d0672438ce5..5e50afeff6e40 100644 --- a/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml +++ b/x-pack/plugin/otel-data/src/yamlRestTest/resources/rest-api-spec/test/20_traces_tests.yml @@ -140,3 +140,21 @@ traces@lifecycle: index: $datastream-backing-index - is_true: $datastream-backing-index - match: { .$datastream-backing-index.settings.index.lifecycle.name: "traces@lifecycle" } +--- +"profiler_stack_trace_ids field should have type counted_keyword": + - do: + bulk: + index: traces-generic.otel-default + refresh: true + body: + - create: {} + - '{"@timestamp":"2024-07-18T14:49:33.467654000Z","data_stream":{"dataset":"generic.otel","namespace":"default"}, "span_id":"1", "attributes": {"elastic.profiler_stack_trace_ids": "S7VyNjRieh4zCEmv7MiwwAcaFlvHvn1cleFkExsq-nbA"}}' + - is_false: errors + - do: + indices.get_data_stream: + name: traces-generic.otel-default + - set: { data_streams.0.indices.0.index_name: idx0name } + - do: + indices.get_mapping: + index: $idx0name + - match: { .$idx0name.mappings.properties.attributes.properties.elastic\.profiler_stack_trace_ids.type: 'counted_keyword' }