# Codec Json not sending data to elasticsearch

**URL:** <https://discuss.elastic.co/t/codec-json-not-sending-data-to-elasticsearch/153018>\
**Category:** Logstash\
**Created:** [October 18, 2018, 2:03pm UTC](https://discuss.elastic.co/t/codec-json-not-sending-data-to-elasticsearch/153018 "2018-10-18T14:03:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dshetty](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dshetty](https://discuss.elastic.co/u/dshetty)\
**Post date:** [October 18, 2018, 2:03pm UTC](https://discuss.elastic.co/t/codec-json-not-sending-data-to-elasticsearch/153018/1 "2018-10-18T14:03:06Z")

</div>

**INPUT: json**

{"userid": 125,"type": "SELL"}  
{"userid": 127,"type": "SELL"}

**LOGSTASH CONF FILE:**

input {  
kafka {  
bootstrap\_servers =\> ""  
topics =\> ["topic1"]  
codec =\> "json"  
}  
}  
output {  
amazon\_es {  
hosts =\> ["XXXX"]  
region =\> "XXXXX"  
aws\_access\_key\_id =\> 'xxxxxxxxxxxx'  
aws\_secret\_access\_key =\> 'xxxxxxxxxxx'  
index =\> "indexname"  
}

stdout { codec =\> rubydebug }  
}

**stdout output:**  
{  
"userid" =\> 127,  
"@version" =\> "1",  
"@timestamp" =\> 2018-10-18T13:54:37.641Z,  
"type" =\> "SELL"  
}

The output looks exactly like what I want. But this will just not go into the elasticsearch topic.  
If I do not use the json filter the entire json goes as 'message' into ES.

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![dshetty](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@dshetty](https://discuss.elastic.co/u/dshetty)\
**Post date:** [October 20, 2018, 12:00am UTC](https://discuss.elastic.co/t/codec-json-not-sending-data-to-elasticsearch/153018/3 "2018-10-20T00:00:19Z")

</div>

I figured the problem. I was using a field called type in my json file data which was causing the problem. logstash stored it as \_type in ES which is no more allowed with the newer versions of elasticsearch. And that is why if my type was 'BUY' it would take the entry and if it was 'SELL' it would reject it.

---

<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:** [November 17, 2018, 12:00am UTC](https://discuss.elastic.co/t/codec-json-not-sending-data-to-elasticsearch/153018/4 "2018-11-17T00:00:20Z")

</div>

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