"index_out_of_bounds_exception

Hi,

When using scripts in term aggregation i am getting "index_out_of_bounds_exception  why is this happening 

{
"took" : 22,
"timed_out" : false,
"_shards" : {
"total" : 3,
"successful" : 2,
"skipped" : 0,
"failed" : 1,
"failures" : [
{
"shard" : 0,
"index" : "my_index",
"node" : "node1",
"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.util.packed.DirectReader$DirectPackedReader8.get(DirectReader.java:145)",
"org.apache.lucene.codecs.lucene70.Lucene70DocValuesProducer$19.ordValue(Lucene70DocValuesProducer.java:865)",
"org.apache.lucene.index.SingletonSortedSetDocValues.advanceExact(SingletonSortedSetDocValues.java:83)",
"org.elasticsearch.index.fielddata.FieldData$10.advanceExact(FieldData.java:345)",
"org.elasticsearch.index.fielddata.ScriptDocValues$BinaryScriptDocValues.setNextDocId(ScriptDocValues.java:635)",
"org.elasticsearch.index.fielddata.ScriptDocValues$Strings.setNextDocId(ScriptDocValues.java:670)",
"org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:94)",
"org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:39)",
"""
if(doc['beat.hostname.keyword'].value== "hostname"){

""",
" ^---- HERE"
],
"script" : """
if(doc['beat.hostname.keyword'].value== "hostname"){
return true;
}
""",
"lang" : "painless",
"caused_by" : {
"type" : "index_out_of_bounds_exception",
"reason" : "index_out_of_bounds_exception: null"
}
}
}
]
},
"hits" : {
"total" : 0,
"max_score" : 0.0,
"hits" :
},
"aggregations" : {
"host_wise" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 0,
"buckets" :
}
}
}

Seeking Help !!!

is it possible that not all of the documents you queried do contain the field you specified? Can you create a fully reproducible example, including index and document creation plus the full query?

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