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( ~[?:?]
at jdk.internal.math.FloatingDecimal.parseFloat( ~[?:?]
at java.lang.Float.parseFloat( ~[?:?]
at ~[elasticsearch-x-content-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$2.parse( ~[elasticsearch-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.NumberFieldMapper$NumberType$2.parse( ~[elasticsearch-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.NumberFieldMapper.parseCreateField( ~[elasticsearch-7.4.2.jar:7.4.2]
at org.elasticsearch.index.mapper.FieldMapper.parse( ~[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": {
    	  "my-xl-column-name": {
    	       "type": "string"                

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