We are using Hibernate with Lucene Backend 8.1.1 Final
After indexing our data, I am creating a composite with multiple aggregations with f.sum() on which I add a .filter() because I only want to target certain elements for the sum. There are cases where one of my aggregations does not find any hits in the index, which is expected. In that case I would expect to get “null” during the extraction of the aggregation sum result. But I get a Null Pointer Exception: Cannot invoke “java.lang.Long.longValue()” because “collector” is null.
I tracked down the issue within AbstractLuceneMetricNumericFieldAggregation as part of the extract(AggregationExtractContext context) method call. The collector which is of type Long (wrapper class) coming from the context.getCollectorResults(collectorKey) is null. On the next line, codec.getDomain() returns a LuceneLongDomain, on which the sortedDocValueToTerm(collector) method is called. Since the method sortedDocValueToTerm expects not a Long but the primitive type long, it tries to convert the collector which is null to its primitive type, triggering the null pointer exception.
Is there current development ongoing in this issue (as composite aggregations is an incubating feature? Or a workaround?