# Reindexing with new field mapping still keeps bytes field as string

**URL:** <https://discuss.elastic.co/t/reindexing-with-new-field-mapping-still-keeps-bytes-field-as-string/180837>\
**Category:** Elasticsearch\
**Created:** [May 13, 2019, 3:03pm UTC](https://discuss.elastic.co/t/reindexing-with-new-field-mapping-still-keeps-bytes-field-as-string/180837 "2019-05-13T15:03:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gerard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerard/32/37017_2.png) [@Gerard](https://discuss.elastic.co/u/Gerard)\
**Post date:** [May 13, 2019, 3:03pm UTC](https://discuss.elastic.co/t/reindexing-with-new-field-mapping-still-keeps-bytes-field-as-string/180837/1 "2019-05-13T15:03:05Z")

</div>

Hi all,

I’m trying to have some json fields typed/mapped as integer, but they keep ending up in Elastic as text fields. My setup:

`Apache > logfile.json > filebeat > … Other side -> logstash > Elastic (6.7) > Kibana`

My data is already parsed as json in Elastic so all fields are separately stored. The bytes fields are showing in the mapping defined as integers. However, looking at the data of a particular document in that index, they still appear as text fields. Anybody know what I’m missing?

I added my mapping that has the integer fields defined, but they don’t seem to work.

nb: I’ve tried to replace the mapping type name from `_default_` to `doc`, `_doc` and others, but still now luck.

Thanks a lot for any pointers!! 🙂

# Relevant source

**Mapping template**

> <https://gist.github.com/gerardjp/644836eece0099ef2a43ffd228fe4aa3>

**reindex json code**

> <https://gist.github.com/gerardjp/a4f60ef23c2942197ff45a7c6d896fab>

# My test workflow

The sequence I follow for testing the mapping on the target destination

**Delete target test index**  
`curl -H 'Content-Type: application/json' -XDELETE http://127.0.0.1:9200/logstash-test-2019.05.10?pretty=true | jq .`

**Upload new mapping with bytes fields as integers**  
`curl -H 'Content-Type: application/json' -XPUT 'http://127.0.0.1:9200/_template/logstash' -d @logstash-test-automapping.json | jq .`

**Reindex to target test index**  
`curl -H 'Content-Type: application/json' -XPOST 'http://127.0.0.1:9200/_reindex' -d @reindex.json`

**Show the test mapping - Showing bytes fields as type integer**  
`curl -H 'Content-Type: application/json' -XGET http://127.0.0.1:9200/logstash-test-2019.05.10?pretty=true | jq .`

**Getting a document from that index**  
`curl -H 'Content-Type: application/json' -XGET http://127.0.0.1:9200/logstash-test-2019.05.10/_doc/ajQvpGoBz9QwF2Bdc9_I?pretty=true | jq .`

---

<div class="post-metadata">

**Author:** ![Gerard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gerard/32/37017_2.png) [@Gerard](https://discuss.elastic.co/u/Gerard)\
**Post date:** [May 20, 2019, 11:42am UTC](https://discuss.elastic.co/t/reindexing-with-new-field-mapping-still-keeps-bytes-field-as-string/180837/2 "2019-05-20T11:42:16Z")

</div>

Ok, and not totally weird because bytes sent could not be a negative, the problem is that bytes sent should be a float instead of a (signed) integer.

---

<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:** [June 17, 2019, 11:42am UTC](https://discuss.elastic.co/t/reindexing-with-new-field-mapping-still-keeps-bytes-field-as-string/180837/3 "2019-06-17T11:42:25Z")

</div>

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