Failed to execute bulk item (index)

I am trying to import a excel file into elasticSearch and have done that fine. But there are some documents (rows in excel) which are not included in the data injest. I digged into the issue with this and found that there is a field "SLA_Duration_in_Mins" in the excel sheet and all errors seen are when this field has certain alphabetic characters instead of usual numeric only characters. Even one of the error lines points to this.

org.elasticsearch.index.mapper.MapperParsingException: failed to parse field [SLA_Duration_in_Mins] of type [float] in document with id '7WYKrW4B1DOOCdRQnMDR'. Preview of field's value: 'Queue is Not Applicable or Not Defined'

It seems that this the error is due to this field not being a float value instead of String which it is.

I am using excelastic to injest data into elasticSearch. Is there a way to specify String value for this field instead of expected floating value?

Below is the "caused by" error stack for reference:

Caused by: java.lang.NumberFormatException: For input string: "Queue is Not Applicable or Not Defined"
at jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054) ~[?:?]
at jdk.internal.math.FloatingDecimal.parseFloat(FloatingDecimal.java:122) ~[?:?]
at java.lang.Float.parseFloat(Float.java:461) ~[?:?]
at org.elasticsearch.common.xcontent.support.AbstractXContentParser.floatValue(AbstractXContentParser.java:223) ~[elasticsearch-x-content-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$2.parse(NumberFieldMapper.java:295) ~[elasticsearch-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$2.parse(NumberFieldMapper.java:271) ~[elasticsearch-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.NumberFieldMapper.parseCreateField(NumberFieldMapper.java:1046) ~[elasticsearch-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.FieldMapper.parse(FieldMapper.java:277) ~[elasticsearch-7.4.2.jar:7.4.2]

Either u choose dynamic mapping / static mapping. In any of this case it is not possible for you to change the mapping type of the field for just 1 value.
What you can do is for this kind of field either use mapping of the type string then it will be able to hold both floating type n string or assign static value of 0.0 (this has to be done in the code).

Thanks for the reply abhijeet. Which code should I make changes to? As i am using excelastic, I dont have direct access to config file that is used by excelastic JAR.

the middleware code that will read xl sheet and will do bulk insert. or map the properties explicitly of elasticsearch and put it as type string. Don't use dynamic mapping. Use static mapping

{

  "mappings": {
	  "type_2":{
    	  "properties":{
    	  "my-xl-column-name": {
    	       "type": "string"                
    	    },

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