# Dynamic Template Not Working - float vs long - Metricbeat Windows Perfmon Counters

**URL:** <https://discuss.elastic.co/t/dynamic-template-not-working-float-vs-long-metricbeat-windows-perfmon-counters/243105>\
**Category:** Elasticsearch\
**Created:** [July 29, 2020, 6:21pm UTC](https://discuss.elastic.co/t/dynamic-template-not-working-float-vs-long-metricbeat-windows-perfmon-counters/243105 "2020-07-29T18:21:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazoutte](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mazoutte/32/120188_2.png) [@mazoutte](https://discuss.elastic.co/u/mazoutte)\
**Post date:** [July 29, 2020, 6:21pm UTC](https://discuss.elastic.co/t/dynamic-template-not-working-float-vs-long-metricbeat-windows-perfmon-counters/243105/1 "2020-07-29T18:21:18Z")

</div>

Hello,

I'm using ELK + Kafka.  
Version : 7.6.2

I'm monitoring Windows machines with Metricbeat and the perfmon module to get some counters.

Here are some counters pulled (a lot of NTDS counters actually, just an example) :  
_windows.perfmon.logicaldisk.avg.disk.sec.write_  
_windows.perfmon.logicaldisk.disk.read.bytes.sec_  
_windows.perfmon.ntds.dirsync.sessions.inprogress_

The problem is that some counters are initiated as "long" type, whereas it should be "float".  
So I decided to delete all the data and the index ; configure dynamic Mapping with a template that match "metricbeat-\*".

Here is the dynamic mapping i'm trying :

```
  {
    "windows.perfmon.*": {
      "unmatch": "windows.perfmon.instance.name",
      "match": "windows.perfmon.*",
      "mapping": {
        "type": "float"
      },
      "match_mapping_type": "*"
    }
  }

```

Unfortunately, when I'm starting the metricbeat agents and gathering some data, the type of the windows.perfmon.\* counters are sometimes float or long ...

```
GET metricbeat-2020.07.29/_mapping/field/windows.perfmon.ntds.*
...
      "windows.perfmon.ntds.ds.client.name.translations.sec" : {
        "full_name" : "windows.perfmon.ntds.ds.client.name.translations.sec",
        "mapping" : {
          "sec" : {
            "type" : "long"
          }
        }
      },
      "windows.perfmon.ntds.ab.client.sessions" : {
        "full_name" : "windows.perfmon.ntds.ab.client.sessions",
        "mapping" : {
          "sessions" : {
            "type" : "long"
          }
        }
      },
...

```

I would love to use the dynamic mapping feature, cause it's clearly easier to manage current and future mappings ...  
I would like to avoid to do a "hard" mapping with each counters I'm pulling (200+ counters)

Any Help is appreciated 😉

Luc

---

<div class="post-metadata">

**Author:** ![mazoutte](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mazoutte/32/120188_2.png) [@mazoutte](https://discuss.elastic.co/u/mazoutte)\
**Post date:** [July 31, 2020, 1:28pm UTC](https://discuss.elastic.co/t/dynamic-template-not-working-float-vs-long-metricbeat-windows-perfmon-counters/243105/2 "2020-07-31T13:28:48Z")

</div>

Hi All,

I did a static mapping in place of dynamic ; which is fine now.

Regards.  
Luc

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 28, 2020, 1:28pm UTC](https://discuss.elastic.co/t/dynamic-template-not-working-float-vs-long-metricbeat-windows-perfmon-counters/243105/3 "2020-08-28T13:28:51Z")

</div>

Closed on August 28, 2020, 1:28pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
