# How to change the default type of MetricBeat index when ingest data to ES

**URL:** <https://discuss.elastic.co/t/how-to-change-the-default-type-of-metricbeat-index-when-ingest-data-to-es/168137>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 13, 2019, 3:22am UTC](https://discuss.elastic.co/t/how-to-change-the-default-type-of-metricbeat-index-when-ingest-data-to-es/168137 "2019-02-13T03:22:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiangziang](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@jiangziang](https://discuss.elastic.co/u/jiangziang)\
**Post date:** [February 13, 2019, 3:22am UTC](https://discuss.elastic.co/t/how-to-change-the-default-type-of-metricbeat-index-when-ingest-data-to-es/168137/1 "2019-02-13T03:22:36Z")

</div>

Hello, everyone.

I added 2 custom fields in "metricbeat.yml" like following:

fields: {xaxis: 1, yaxis: 1}

After data store in ES, those 2 fields are defined as "String" type in the mapping definition:

{  
"fields": {  
"path\_match": "fields.\*",  
"match\_mapping\_type": "string",  
"mapping": {  
"type": "keyword"  
}  
}  
}

So, may I know if there is a configuration item to let me modify the type from "String" to "Long" for custom fields?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [February 14, 2019, 4:00pm UTC](https://discuss.elastic.co/t/how-to-change-the-default-type-of-metricbeat-index-when-ingest-data-to-es/168137/2 "2019-02-14T16:00:44Z")

</div>

There is a "hidden" setting callend `append_fields` that you can use for that: [https://github.com/elastic/beats/blob/master/libbeat/\_meta/config.reference.yml#L863](https://github.com/elastic/beats/blob/master/libbeat/_meta/config.reference.yml#L863)

It has the same structure as the fields.yml we use inside our repository.

For your case it would be:

```auto
- name: fields.xaxis
  type: log

```

If you change anything here, you must overwrite your existing template and it will only apply to new indices.

---

<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:** [March 14, 2019, 4:00pm UTC](https://discuss.elastic.co/t/how-to-change-the-default-type-of-metricbeat-index-when-ingest-data-to-es/168137/3 "2019-03-14T16:00:47Z")

</div>

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