# Elasticsearch create index with wrong fields types

**URL:** <https://discuss.elastic.co/t/elasticsearch-create-index-with-wrong-fields-types/87562>\
**Category:** Elasticsearch\
**Created:** [May 30, 2017, 12:19pm UTC](https://discuss.elastic.co/t/elasticsearch-create-index-with-wrong-fields-types/87562 "2017-05-30T12:19:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chelius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chelius/32/18633_2.png) [@chelius](https://discuss.elastic.co/u/chelius)\
**Post date:** [May 30, 2017, 12:19pm UTC](https://discuss.elastic.co/t/elasticsearch-create-index-with-wrong-fields-types/87562/1 "2017-05-30T12:19:31Z")

</div>

Hi all!  
I want to get my haproxy logs and visualize there with Kibana, but i have problem.  
I make config for logstash  
input {  
file {  
path =\> "/var/log/haproxy.log"  
start\_position =\> "end"  
stat\_interval =\> 1  
discover\_interval =\> 30  
}  
file {  
path =\> "/var/log/haproxy.log.1"  
start\_position =\> "end"  
stat\_interval =\> 1  
discover\_interval =\> 30  
}  
}  
filter {  
grok {  
patterns\_dir =\> "/etc/logstash/conf.d/patterns"  
match =\> { "message" =\> "%{HAPROXYHTTP}" }  
}  
}  
output {  
elasticsearch {  
hosts =\> ["10.0.20.10:9200"]  
index =\> "haproxy-%{+YYYY.MM.dd}"  
}  
}

I used the standard haproxy pattern, which specifies the data types, but in Kibana I see that all fields are of the string type. What is my mistake? Why elasticsearch not receive correct field types?  
Thx and sorry for my poor english

 ![](https://us1.discourse-cdn.com/elastic/original/3X/8/e/8e8797a0e254c6db548b11aedd99c18467ed95a9.PNG)

---

<div class="post-metadata">

**Author:** ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)\
**Post date:** [May 30, 2017, 2:18pm UTC](https://discuss.elastic.co/t/elasticsearch-create-index-with-wrong-fields-types/87562/2 "2017-05-30T14:18:23Z")

</div>

Logstash doesn't make the field types. Elasticsearch mappings do. Logstash provides a mapping template, but it only works for indices that start with `logstash-`. You will have to make your own mapping template for your data. You can base it off of the [template Logstash provides](https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/v7.3.2/lib/logstash/outputs/elasticsearch/elasticsearch-template-es5x.json).

---

<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 27, 2017, 2:18pm UTC](https://discuss.elastic.co/t/elasticsearch-create-index-with-wrong-fields-types/87562/3 "2017-06-27T14:18:33Z")

</div>

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