# Converting a string field of already ingested documents to an integer field

**URL:** <https://discuss.elastic.co/t/converting-a-string-field-of-already-ingested-documents-to-an-integer-field/260368>\
**Category:** Elasticsearch\
**Created:** [January 6, 2021, 4:27pm UTC](https://discuss.elastic.co/t/converting-a-string-field-of-already-ingested-documents-to-an-integer-field/260368 "2021-01-06T16:27:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsalamanca](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@jsalamanca](https://discuss.elastic.co/u/jsalamanca)\
**Post date:** [January 6, 2021, 4:27pm UTC](https://discuss.elastic.co/t/converting-a-string-field-of-already-ingested-documents-to-an-integer-field/260368/1 "2021-01-06T16:27:11Z")

</div>

Hi,

I'm trying to convert the type of a field of already ingested documents to another type.

The pipeline incorrectly ingested documents with integers as strings, like "1" or "2" (or any other integer as string). I already corrected my logstash config file, but now I want to correct the type of the field of all the stored documents, as now I have a mapping conflict in my index pattern, and cannot do proper aggregations.

I am completely sure the conversion will never fail as the field will always have strings as "1", "2" or "3" (or any other integer number). This only happens in one index, in one field.

My Elasticsearch version is 7.3.2, Logstash 7.3.2, Kibana 7.3.2.

What is the easiest way to accomplish this?

Thanks in advance and Regards,

Jorge

---

<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:** [February 3, 2021, 4:27pm UTC](https://discuss.elastic.co/t/converting-a-string-field-of-already-ingested-documents-to-an-integer-field/260368/2 "2021-02-03T16:27:19Z")

</div>

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