# ElasticSearch Mapping Issue for String fields

**URL:** <https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548>\
**Category:** Elasticsearch\
**Created:** [September 18, 2015, 7:50am UTC](https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548 "2015-09-18T07:50:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vsingh2020](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@vsingh2020](https://discuss.elastic.co/u/vsingh2020)\
**Post date:** [September 18, 2015, 7:50am UTC](https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548/1 "2015-09-18T07:50:45Z")

</div>

Hi All,

We have a requirement where in we have to insert data to elasticSearch from the Source file.  
We are using Java API to connect to ElasticSearch and then using JAVA API methods to perform action in ElasticSearch. So far we did following:  
a) We have created an index  
b) We have created a mapping for the Index.  
c) Then try to insert data to the above created index using JAVA API

We are able to successfully insert data when the data format is:  
XXXXXX=1234 ( **This is the first insert** )  
But when the data format is XXXXXX=1234-1234 ( **Second insert** ) we are getting error message.  
If we insert the data (the second format) first then we are not getting any error message.

But when we tried to insert data we are getting below error message:  
**org.elasticsearch.index.mapper.MapperParsingException: failed to parse [XXXXXX]**

Please find below the mapping snippet for the same:  
"XXXXXX" : {  
"type" : "string",  
"index\_analyzer" : "text\_with\_autocomplete\_analyzer",  
"search\_analyzer" : "text\_standard\_analyzer",  
"fields" : {  
"partial\_matching" : {  
"type" : "string",  
"index\_analyzer" : "text\_with\_partial\_matching\_analyzer",  
"search\_analyzer" : "text\_standard\_analyzer"  
},  
"raw" : {  
"type" : "string",  
"analyzer" : "text\_sortable"  
}  
}  
}

Please let me know if any further details are required for the same.

Any help will be highly appreciated.

Regards,  
Vishal

---

<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:** [September 19, 2015, 2:04am UTC](https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548/2 "2015-09-19T02:04:50Z")

</div>

It sounds like something is not aligned, so when you insert the data it is not matching the mapping.

Are you setting the types correctly?

---

<div class="post-metadata">

**Author:** ![vsingh2020](https://avatars.discourse-cdn.com/v4/letter/v/9dc877/32.png) [@vsingh2020](https://discuss.elastic.co/u/vsingh2020)\
**Post date:** [September 19, 2015, 10:04am UTC](https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548/3 "2015-09-19T10:04:48Z")

</div>

We are using Java PrepareIndex java API to insert data into ES database.

Can you please let me know where exactly we have to set the type?

---

<div class="post-metadata">

**Author:** ![eliasah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eliasah/32/34741_2.png) [@eliasah](https://discuss.elastic.co/u/eliasah)\
**Post date:** [September 19, 2015, 5:56pm UTC](https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548/4 "2015-09-19T17:56:13Z")

</div>

Your mapping snipped does not allow us to reproduce the error. So we can't help you if you don't try at least to write and format your code correctly.

So please do that!

---

<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:** [July 5, 2017, 11:49pm UTC](https://discuss.elastic.co/t/elasticsearch-mapping-issue-for-string-fields/29548/5 "2017-07-05T23:49:16Z")

</div>


