Hello,
We are using metricbeat (8.14) on k8s to ship metrics to an elasticsearch (8.13) cluster. This has been working well however last week we discovered a mapping issue where sometimes some of our metrics are getting set as a float and somtimes they are getting set as a long. We have been using dynamic mapping and this is likely why this is happening. We would like to move to static mapping using the metricbeat provided index template. Our current index template looks like so:
{
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "bmap_obsv_ilm_policy"
},
"routing": {
"allocation": {
"include": {
"_tier_preference": "data_hot"
}
}
},
"mapping": {
"total_fields": {
"limit": "2000"
}
},
"refresh_interval": "30s",
"number_of_shards": "1",
"number_of_replicas": "1"
}
},
"mappings": {
"dynamic": "true"
},
"aliases": {}
}
}
On our test environment I was able to switch to the metricbeat provided index template and everything worked as expected however when I switched our dev environment over to it I was getting the following error from metricbeat:
{"log.level":"debug","@timestamp":"2024-08-27T16:49:15.747Z","log.logger":"elasticsearch","log.origin":{"function":"github.com/elastic/beats/v7/libbeat/outputs/elasticsearch.(*Client).bulkCollectPublishFails","file.name":"elasticsearch/client.go","file.line":430},"message":"Cannot index event publisher.Event{Content:beat.Event{Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), Meta:null, Fields:null, Private:interface {}(nil), TimeSeries:false}, Flags:0x0, Cache:publisher.EventCache{m:mapstr.M(nil)}, EncodedEvent:(*elasticsearch.encodedEvent)(0xc004c26d80)} (status=400): {\"type\":\"routing_missing_exception\",\"reason\":\"routing is required for [.ds-dev2-cust-eastus-metrics-8.14.0-2024.08.27-2024.08.27-000001]/[noC9lJEBUqYkhwlM2TDh]\",\"index_uuid\":\"_na_\",\"index\":\".ds-dev2-cust-eastus-metrics-8.14.0-2024.08.27-2024.08.27-000001\"}, dropping event!","service.name":"metricbeat","ecs.version":"1.6.0"}
I'm looking for help trying to figure out why this might be.
Here is the index template which we are trying to move to but having issues:
(too large to include here)
switching back to the current basic dynamic index template fixes the issue and allows metricbeat to start shipping metrics again and this index template is all that is changing so it seems something specified in this index template is causing issues but I'm unsure what.