Hi,
I use a simple painless script "doc['myFieldName'].value" for my aggregation with ES 5.3 and I get the following exception:
java.lang.AssertionError: docid=-1,maxDoc=29
at __randomizedtesting.SeedInfo.seed([9BC01C49C008CD2B]:0)
at org.apache.lucene.index.AssertingLeafReader$AssertingRandomAccessOrds.setDocument(AssertingLeafReader.java:554)
at org.elasticsearch.index.fielddata.FieldData$8.setDocument(FieldData.java:403)
at org.elasticsearch.index.fielddata.ScriptDocValues$Strings.setNextDocId(ScriptDocValues.java:93)
at org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:92)
at org.elasticsearch.painless.Executable$Script.execute(doc['ICUZ'].value:5)
at org.elasticsearch.painless.ScriptImpl.run(ScriptImpl.java:123)
at org.elasticsearch.search.aggregations.support.ValuesSource$WithScript$BytesValues.setDocument(ValuesSource.java:478)
at org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregator$1.collect(StringTermsAggregator.java:81)
at org.elasticsearch.search.aggregations.LeafBucketCollector.collect(LeafBucketCollector.java:82)
at org.apache.lucene.search.MultiCollector$MultiLeafCollector.collect(MultiCollector.java:174)
at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:221)
at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:172)
at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39)
The field exists : I can see in debug mode that ES is able to read the field value for the current document but it fails to collect the doc id (it tries to collect "-1" as a docid).
Does anybody have any idea of what is going on?
Thanks,