Metricbeat 7.17.20 cannot index logstash metrics into Elasticsearch

i'm using metricbeat to monitor logstash (also 7.17.20). both are running in docker.
Metricbeat is logging the following error:
mapper [logstash_stats.pipelines.events.duration_in_millis] cannot be changed from type [float] to [long]

Metricbeat configuration:

metricbeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false
processors:
  - add_cloud_metadata: ~
  - add_docker_metadata: ~

output.elasticsearch:
  hosts: https://es-log.domain.internal:9200
  username: logstash-log
  password: ...

name: ls-dev-log-0-i-0182be70eacab9ae8.euw1
monitoring:
  cluster_uuid: ...
  enabled: true
logging.level: debug

Module config:

- module: logstash
  enabled: true
  xpack.enabled: true
  period: 10s
  hosts: ["http://logstash:9600"]

The data:

2024-04-25T15:28:56.979Z        DEBUG   [processors]    processing/processors.go:203    Publish event: {                                                                                                                                                                                  
  "@timestamp": "2024-04-25T15:28:56.912Z",                                                                                                                                                                                                                                               
  "@metadata": {                                                                                                                                                                                                                                                                          
    "beat": "metricbeat",                                                                                                                                                                                                                                                                 
    "type": "_doc",                                                                                                                                                                                                                                                                       
    "version": "7.17.20",                                                                                                                                                                                                                                                                 
    "index": ".monitoring-logstash-7-mb"                                                                                                                                                                                                                                                  
  },                                                                                                                                                                                                                                                                                      
  "interval_ms": 10000,                                                                                                                                                                                                                                                                   
  "logstash_stats": {                                                                                                                                                                                                                                                                     
    "events": {                                                                                                                                                                                                                                                                           
      "duration_in_millis": 4.7338102e+07,                                                                                                                                                                                                                                                
      "in": 4.4495605e+07,                                                                                                                                                                                                                                                                
      "filtered": 4.4495605e+07,                                                                                                                                                                                                                                                          
      "out": 4.3300184e+07                                                                                                                                                                                                                                                                
    },                           

why are the numbers in floating point format? is there a way to turn that off?

it turned out the issue was in the elasticsearch template. we have a default index template which unfortunately overlaped the default monitoring templates.
index template [default-logs] has index patterns [*logs*] matching patterns from existing older templates [.monitoring-logstash,.monitoring-es,logstash,ecs-logstash,.monitoring-beats,.items-default,.lists-default,.monitoring-kibana] with patterns (.monitoring-logstash => [.monitoring-logstash-7-*],.monitoring-es => [.monitoring-es-7-*],logstash => [logstash-*],ecs-logstash => [ecs-logstash-*],.monitoring-beats => [.monitoring-beats-7-*],.items-default => [.items-default-*],.lists-default => [.lists-default-*],.monitoring-kibana => [.monitoring-kibana-7-*]); this template [default-logs] will take precedence during new index creation
changing the pattern on our template fixed the issue