ElasticSearch Mapping Issue for String fields

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

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?

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?

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!