Hi, getting below error while running painless script in elasticsearch 6.7. Any hint or fix ?
"failures": [
{
"shard": 2,
"index": "mpis_test",
"node": "qYRoYv39RZqGrP7iAhukcQ",
"reason": {
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"java.nio.Buffer.checkIndex(Buffer.java:540)",
"java.nio.DirectByteBuffer.get(DirectByteBuffer.java:253)",
"org.apache.lucene.store.ByteBufferGuard.getByte(ByteBufferGuard.java:118)",
"org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.readByte(ByteBufferIndexInput.java:385)",
"org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$10.get(Lucene70DocValuesProducer.java:599)",
"org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$21.nextValue(Lucene70DocValuesProducer.java:1223)",
"org.elasticsearch.index.fielddata.plain.SortedNumericDVIndexFieldData$MultiFloatValues.nextValue(SortedNumericDVIndexFieldData.java:353)",
"org.elasticsearch.index.fielddata.ScriptDocValues$Doubles.setNextDocId(ScriptDocValues.java:365)",
"org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:94)",
"org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:39)",
"arr = doc['display.passengerTypePrices.total']; int ",
" ^---- HERE"
],
"script": "double adt = 0, cnn = 0, inf = 0; double addTax = 0; if (doc['display.locationId.reservationSystemIdentifier.keyword'].value == params.taxIdentifier) { if(doc['display.qualifiers.tariffTypes.keyword'].value== 'PUBLISHED') addTax = params.Published; else if(doc['display.qualifiers.tariffTypes.keyword'].value== 'NEGO') addTax = params.Nego; else if(doc['display.qualifiers.tariffTypes.keyword'].value== 'CORPORATE_NEGO' && doc['display.qualifiers.corporateCodes.value.keyword'].value == params.OfficeId) addTax = params.corporate_Nego; } def arr = doc['display.passengerTypePrices.total']; int arrlen = arr.length; for(int i = 0; i<arr.length;i++){if(doc['display.passengerTypePrices.passengerType.keyword'][i]=='ADT') adt = arr[(arrlen - 1) - i]; else if(doc['display.passengerTypePrices.passengerType.keyword'][i]=='CNN') cnn = arr[(arrlen - 1) - i]; else if(doc['display.passengerTypePrices.passengerType.keyword'][i]=='INF') inf = arr[(arrlen - 1) - i]; } return (((adt + addTax) params.ADT) + ((cnn + addTax) params.CNN) + ((inf + addTax) * params.INF));",
"lang": "painless",
"caused_by": {
"type": "index_out_of_bounds_exception",
"reason": null
}
}
}
]