# Mutate --\> convert doesn't work

**URL:** <https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551>\
**Category:** Logstash\
**Created:** [March 29, 2020, 12:51pm UTC](https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551 "2020-03-29T12:51:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaseemQA](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vaseemQA](https://discuss.elastic.co/u/vaseemQA)\
**Post date:** [March 29, 2020, 12:51pm UTC](https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551/1 "2020-03-29T12:51:05Z")

</div>

Hi Team,

I'm trying to change a field data type from string to integer but it doesn't work.  
see below example:

1. ![Screenshot 2020-03-29 at 6.14.38 PM](https://us1.discourse-cdn.com/elastic/original/3X/6/2/62c020111d6b430887d31969f7d7eb809a219e1d.png)

In the above example, `neededFieldinInt` and `number_of_documents` I need in integer and below is the code which I've used to achieve

 ![Screenshot 2020-03-29 at 6.19.42 PM](https://us1.discourse-cdn.com/elastic/original/3X/a/5/a5244851980d4bd5632a806fa013384506a8b551.png)  
 ![Screenshot 2020-03-29 at 6.17.45 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/0/1038784232296ea4bf0153076821f955b6e8d0d3.png)  
can anyone please help me with this.  
Thanks,  
Vaseem!

---

<div class="post-metadata">

**Author:** ![rugenl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rugenl/32/12887_2.png) [@rugenl](https://discuss.elastic.co/u/rugenl)\
**Post date:** [March 29, 2020, 2:48pm UTC](https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551/2 "2020-03-29T14:48:10Z")

</div>

This won't change the mapping of an existing index (You can't change the mapping of an existing index). When a new index is created (rollover, by date) it might, provided no conflicting mapping is defined in a template and the first occurrence of the field arrives as integer.ff

Then the Kibana index pattern will need to be updated and if your name\* matches both old and new indices, you will have a mapping conflict in Kibana.

---

<div class="post-metadata">

**Author:** ![vaseemQA](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vaseemQA](https://discuss.elastic.co/u/vaseemQA)\
**Post date:** [March 29, 2020, 2:52pm UTC](https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551/3 "2020-03-29T14:52:44Z")

</div>

> [@rugenl](#):
>
> existing

Hi Len,

The fields number\_of\_documents and neededFieldinInt are parsed from a message field which means these are newly added fields.

---

<div class="post-metadata">

**Author:** ![vaseemQA](https://avatars.discourse-cdn.com/v4/letter/v/4491bb/32.png) [@vaseemQA](https://discuss.elastic.co/u/vaseemQA)\
**Post date:** [March 30, 2020, 4:31am UTC](https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551/4 "2020-03-30T04:31:38Z")

</div>

Hey Len Rugen,

It worked on changing the field name someone has defined same field with string field.

Thanks.  
Vaseem

---

<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:** [April 27, 2020, 4:31am UTC](https://discuss.elastic.co/t/mutate-convert-doesnt-work/225551/5 "2020-04-27T04:31:43Z")

</div>

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