# Cannot write to elasticsearch

**URL:** <https://discuss.elastic.co/t/cannot-write-to-elasticsearch/66073>\
**Category:** Logstash\
**Created:** [November 15, 2016, 8:54am UTC](https://discuss.elastic.co/t/cannot-write-to-elasticsearch/66073 "2016-11-15T08:54:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gringo](https://avatars.discourse-cdn.com/v4/letter/g/f19dbf/32.png) [@gringo](https://discuss.elastic.co/u/gringo)\
**Post date:** [November 15, 2016, 8:54am UTC](https://discuss.elastic.co/t/cannot-write-to-elasticsearch/66073/1 "2016-11-15T08:54:33Z")

</div>

I have a logstash script that reads log and output to elasticsearch  
Logstash vesion: 2.2.2  
Elasticsearch: 2.3.4

It runs and display fine when  
stdout { codec =\> rubydebug }  
is enabled.

when I only enable  
elasticsearch {  
index =\> "logstash-myindexname-%{@index}"  
hosts =\> "192.168.22.112:9200"  
}

I keep getting this exception

response=\>{"create"=\>{"\_index"=\>"myindexname-2016-11-13", "\_type"=\>"cisco", "\_id"=\>"AVhnLEE0NsFvfd8lLGSi", "status"=\>400, "error"=\>{"type"=\>"mapper\_parsing\_exception", "reason"=\>"failed to parse", "caused\_by"=\>{"type"=\>"illegal\_state\_exception", "reason"=\>"Mixing up field types: class org.elasticsearch.index.mapper.core.StringFieldMapper$StringFieldType != class org.elasticsearch.index.mapper.internal.IndexFieldMapper$IndexFieldType on field \_index"}}}}, :level=\>:warn}←[0m

What is wrong here? I cannot find the problem at all.

---

<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 13, 2016, 8:54am UTC](https://discuss.elastic.co/t/cannot-write-to-elasticsearch/66073/2 "2016-12-13T08:54:38Z")

</div>

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