# Logstash how to set field index type from json input

**URL:** https://discuss.elastic.co/t/logstash-how-to-set-field-index-type-from-json-input/106653
**Category:** Logstash
**Created:** [November 7, 2017, 9:06am UTC](https://discuss.elastic.co/t/logstash-how-to-set-field-index-type-from-json-input/106653 "2017-11-07T09:06:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![imqishi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/imqishi/32/23426_2.png) [@imqishi](https://discuss.elastic.co/u/imqishi)
#### Post date: [November 7, 2017, 9:06am UTC](https://discuss.elastic.co/t/logstash-how-to-set-field-index-type-from-json-input/106653/1 "2017-11-07T09:06:30Z")

</div>

I want save data to elasticsearch by a json input, but when I created it I found that all my field type is string...

I try to format my data and it can achieve number and string two types' indices like this:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/9/79a65ae8287a4c53ea388f69d9fc8511c4c52c2f.png)

But c is an IP type here it is classified as string too... And I try to use mutate but find mutate can only support integer, float, string, and boolean convertion.

So is there a way to customize field type? Thanks

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 7, 2017, 10:08am UTC](https://discuss.elastic.co/t/logstash-how-to-set-field-index-type-from-json-input/106653/2 "2017-11-07T10:08:24Z")

</div>

It's Elasticsearch that controls the mappings of the index, although actions taken in Logstash can affect the choices ES makes. Have a look at mappings and index templates in the ES documentation.

---

<div class="post-metadata">

### Author: ![imqishi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/imqishi/32/23426_2.png) [@imqishi](https://discuss.elastic.co/u/imqishi)
#### Post date: [November 8, 2017, 6:35am UTC](https://discuss.elastic.co/t/logstash-how-to-set-field-index-type-from-json-input/106653/3 "2017-11-08T06:35:21Z")

</div>

Well, you're right. Now I use index-template in elasticsearch to solve this, thank you

---

<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: [December 6, 2017, 6:35am UTC](https://discuss.elastic.co/t/logstash-how-to-set-field-index-type-from-json-input/106653/4 "2017-12-06T06:35:21Z")

</div>

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