Skip to content

Commit 42b6976

Browse files
[Profiling] Don't map new fields by default (#96876)
With this commit we set the mapping parameter `dynamic` to `false` for all profiling-related indices / index templates. Previously we were relying on the default behavior which would have mapped new fields dynamically. This is problematic for schema evolution. With this change we will still accept documents with additional fields but they will not be automatically added to the mappings.
1 parent fe9f008 commit 42b6976

File tree

10 files changed

+15
-4
lines changed

10 files changed

+15
-4
lines changed

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-events.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"_source": {
2525
"enabled": false
2626
},
27+
"dynamic": false,
2728
"properties": {
2829
"ecs.version": {
2930
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-executables.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"_source": {
1414
"mode": "synthetic"
1515
},
16+
"dynamic": false,
1617
"properties": {
1718
"ecs.version": {
1819
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-hosts.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"_source": {
2020
"enabled": true
2121
},
22+
"dynamic": false,
2223
"properties": {
2324
"ecs.version": {
2425
"type": "keyword"
@@ -31,7 +32,6 @@
3132
"format": "epoch_second"
3233
},
3334
"profiling": {
34-
"dynamic": false,
3535
"properties": {
3636
"project.id": {
3737
"type": "keyword"
@@ -160,7 +160,6 @@
160160
}
161161
},
162162
"ec2": {
163-
"dynamic": false,
164163
"properties": {
165164
"ami_id": {
166165
"type": "keyword"
@@ -224,7 +223,6 @@
224223
}
225224
},
226225
"azure": {
227-
"dynamic": false,
228226
"properties": {
229227
"compute.sku": {
230228
"type": "keyword"
@@ -268,7 +266,6 @@
268266
}
269267
},
270268
"gce": {
271-
"dynamic": false,
272269
"properties": {
273270
"instance.id": {
274271
"type": "keyword"

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-metrics.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
"_source": {
2020
"enabled": false
2121
},
22+
/*
23+
We intentionally allow dynamic mappings for metrics. Which metrics are added is guarded by
24+
the collector and we want to allow adding new metrics over time. As this is a datastream,
25+
which will age and eventually be deleted, schema evolution is not a major concern here.
26+
*/
27+
"dynamic": true,
2228
"properties": {
2329
"ecs.version": {
2430
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-stackframes.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"_source": {
2222
"enabled": true
2323
},
24+
"dynamic": false,
2425
"properties": {
2526
"ecs.version": {
2627
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-stacktraces.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"_source": {
2020
"mode": "synthetic"
2121
},
22+
"dynamic": false,
2223
"properties": {
2324
"ecs.version": {
2425
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/component-template/profiling-symbols.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"_source": {
1818
"enabled": true
1919
},
20+
"dynamic": false,
2021
"properties": {
2122
"ecs.version": {
2223
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/index-template/profiling-returnpads-private.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"_source": {
2020
"enabled": true
2121
},
22+
"dynamic": false,
2223
"properties": {
2324
"ecs.version": {
2425
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/index-template/profiling-sq-executables.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"_source": {
1616
"mode": "synthetic"
1717
},
18+
"dynamic": false,
1819
"properties": {
1920
"ecs.version": {
2021
"type": "keyword",

x-pack/plugin/core/src/main/resources/org/elasticsearch/xpack/profiler/index-template/profiling-sq-leafframes.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"_source": {
1616
"mode": "synthetic"
1717
},
18+
"dynamic": false,
1819
"properties": {
1920
"ecs.version": {
2021
"type": "keyword",

0 commit comments

Comments
 (0)