# Unable to create index properly in elastic search

**URL:** <https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087>\
**Category:** Logstash\
**Created:** [February 15, 2018, 11:26pm UTC](https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087 "2018-02-15T23:26:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arkapravo\_Das](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arkapravo_das/32/78953_2.png) [@Arkapravo\_Das](https://discuss.elastic.co/u/Arkapravo_Das)\
**Post date:** [February 15, 2018, 11:26pm UTC](https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087/1 "2018-02-15T23:26:37Z")

</div>

Hi All,  
I am using elastic search 1.7 and logstash 1.5 basic version[no plugin installed]. I am trying to create a document to elastic search ,getting input from stdin

Here is my pipeline config:

input{  
stdin{}  
}

output{  
elasticsearch {

```
	host => ["localhost:9200"]
	index =>"test"
	protocol => "http"
	document_type =>"details"
	manage_template =>"false"
	template => "C:\es_workspace\logstash-1.5.0\logstash-1.5.0\es_mapping\details.json"
    template_name => "details"
	
	}
} 

```

Here is my mapping details:  
{  
"test": {  
"mappings": {  
"details": {  
"properties": {  
"CustomerContactID": {  
"type": "string",  
"index": "not\_analyzed",  
"store": true  
},  
"OrderNo": {  
"type": "string",  
"index": "not\_analyzed",  
"store": true  
},  
"SellerOrganizationCode": {  
"type": "string",  
"index": "not\_analyzed",  
"store": true  
}  
}  
}  
}  
}  
}

My input to stdin is : {"test":{"SellerOrganizationCode":"TCO\_US","CustomerContactID":"0123","OrderNo":"0123"}}

It is creating a document in elastic search, I can see but the properties of the document[as an example:SellerOrganizationCode should get populated with TCO\_US, OrderNo should get populated with 0123] are not getting updated.

 ![Diff_documents](https://us1.discourse-cdn.com/elastic/original/3X/e/7/e7e87bf1b70041282ab088c8cacd8ca01092f69b.JPG)

After doing some investigation, I found this:  
The document getting created by logstash is like this:

![Created_By_logstash](https://us1.discourse-cdn.com/elastic/original/3X/0/3/03a0892aa19e7fa47591aada0f98f440d3a7e36e.JPG)

But if I create a document by elastic head[which populates the properties correctly] is like this:  
 ![Created_By_Head](https://us1.discourse-cdn.com/elastic/original/3X/7/2/72ec65a7ecf80b3b4fe6f678ff457a82f4800c6f.JPG)

The source of the previous document is having an extra element named "message".

Please help me here.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 15, 2018, 11:40pm UTC](https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087/2 "2018-02-15T23:40:24Z")

</div>

> [@Arkapravo\_Das](#):
>
> I am using Elasticsearch 1.7 and logstash 1.5

Why such old versions? Can you upgrade?

Basically you need the json codec in your Logstash, so that it pulls apart the message and creates separate fields. [Json codec plugin | Logstash Reference [8.11] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-codecs-json.html)

---

<div class="post-metadata">

**Author:** ![Arkapravo\_Das](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arkapravo_das/32/78953_2.png) [@Arkapravo\_Das](https://discuss.elastic.co/u/Arkapravo_Das)\
**Post date:** [February 16, 2018, 1:12pm UTC](https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087/3 "2018-02-16T13:12:35Z")

</div>

It worked with the codec. Thanks a ton.

To your question: why such older versions? ,  
What is the latest version of logstash I can use with 1.7 elastic search?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [February 16, 2018, 11:53pm UTC](https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087/4 "2018-02-16T23:53:13Z")

</div>

The latest is 6.2.1.

---

<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:** [March 16, 2018, 11:53pm UTC](https://discuss.elastic.co/t/unable-to-create-index-properly-in-elastic-search/120087/5 "2018-03-16T23:53:29Z")

</div>

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