IndexOutOfBoundsException while accessing a field value using leafdoclookup.get(fieldname+".keyword")

Caused by: java.lang.IndexOutOfBoundsException: -1
at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:253) ~[?:1.8.0_131]
at org.apache.lucene.store.ByteBufferGuard.getByte(ByteBufferGuard.java:118) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.store.ByteBufferIndexInput$SingleBufferImpl.readByte(ByteBufferIndexInput.java:385) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.util.packed.DirectReader$DirectPackedReader4.get(DirectReader.java:126) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.codecs.lucene54.Lucene54DocValuesProducer$2.get(Lucene54DocValuesProducer.java:501) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.util.LongValues.get(LongValues.java:45) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.codecs.lucene54.Lucene54DocValuesProducer$7.getOrd(Lucene54DocValuesProducer.java:799) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.index.SingletonSortedSetDocValues.setDocument(SingletonSortedSetDocValues.java:52) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.elasticsearch.index.fielddata.FieldData$8.setDocument(FieldData.java:403) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.index.fielddata.ScriptDocValues$Strings.setNextDocId(ScriptDocValues.java:93) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:89) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.zemoso.zededupe.customscoreplugin.DeDupeScript.runAsDouble(DeDupeScript.java:215) ~[?:?]
at org.elasticsearch.common.lucene.search.function.ScriptScoreFunction$1.score(ScriptScoreFunction.java:88) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.common.lucene.search.function.FunctionScoreQuery$FunctionFactorScorer.score(FunctionScoreQuery.java:200) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.apache.lucene.search.TopScoreDocCollector$SimpleTopScoreDocCollector$1.collect(TopScoreDocCollector.java:64) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:246) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:197) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:668) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.elasticsearch.search.internal.ContextIndexSearcher.search(ContextIndexSearcher.java:196) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:472) ~[lucene-core-6.6.1.jar:6.6.1 9aa465a89b64ff2dabe7b4d50c472de32c298683 - varunthacker - 2017-08-29 21:54:39]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:421) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:252) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:267) ~[elasticsearch-5.6.1.jar:5.6.1]
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:340) ~[elasticsearch-5.6.1.jar:5.6.1]

Query Used :
"query":
{
"function_score" : {
"query" : {
"match_all" : {
"boost" : 1.0
}
},
"functions" : [
{
"filter" : {
"match_all" : {
"boost" : 1.0
}
},
"script_score" : {
"script" : {
"source" : "pure_df",
"lang" : "expert_scripts",
"params" : {
"entity" : {
"fields" : [
{ "field" : "firstname",
"value" : "SMITH"},
{"field" : "lastname",
"value" : "albert"
}
]
}
}
}
}
}
],
"score_mode" : "max",
"boost_mode" : "replace",
"max_boost" : 3.4028235E38,
"boost" : 1.0
}

run as double method overrided

@Override
public double runAsDouble() {
LeafDocLookup doc = lookup.getLeafSearchLookup(context).doc();
logger.info("doc: "+doc);
logger.info("doc.get(key): "+doc.get("firstname.keyword"));/////EXCEPTION AT THIS LINE//////

}

Can anyone kindly help me out?

.

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