@@ -220,7 +220,7 @@ private class TermsAggregationReducer implements AggregatorReducer {
220220 private final int size ;
221221
222222 private long sumDocCountError = 0 ;
223- private final long [] otherDocCount = new long [] { 0 } ;
223+ private long otherDocCount = 0 ;
224224 private A referenceTerms = null ;
225225 /*
226226 * Buckets returned by a partial reduce or a shard response are sorted by key since {@link Version#V_7_10_0}.
@@ -255,7 +255,7 @@ public void accept(InternalAggregation aggregation) {
255255 } else if (thisReduceOrder != getOrder () && thisReduceOrder .equals (terms .getReduceOrder ()) == false ) {
256256 thisReduceOrder = getOrder ();
257257 }
258- otherDocCount [ 0 ] += terms .getSumOfOtherDocCounts ();
258+ otherDocCount += terms .getSumOfOtherDocCounts ();
259259 final long thisAggDocCountError = getDocCountError (terms );
260260 setDocCountError (thisAggDocCountError );
261261 if (sumDocCountError != -1 ) {
@@ -297,14 +297,14 @@ public InternalAggregation get() {
297297 reduceContext .consumeBucketsAndMaybeBreak (1 );
298298 result .add (bucket .reduced (AbstractInternalTerms .this ::reduceBucket , reduceContext ));
299299 } else {
300- otherDocCount [ 0 ] += bucket .getDocCount ();
300+ otherDocCount += bucket .getDocCount ();
301301 }
302302 });
303303 } else if (reduceContext .isFinalReduce ()) {
304304 TopBucketBuilder <B > top = TopBucketBuilder .build (
305305 getRequiredSize (),
306306 getOrder (),
307- removed -> otherDocCount [ 0 ] += removed .getDocCount (),
307+ removed -> otherDocCount += removed .getDocCount (),
308308 AbstractInternalTerms .this ::reduceBucket ,
309309 reduceContext
310310 );
@@ -334,7 +334,7 @@ public InternalAggregation get() {
334334 if (sumDocCountError != -1 ) {
335335 docCountError = size == 1 ? 0 : sumDocCountError ;
336336 }
337- return create (name , result , reduceContext .isFinalReduce () ? getOrder () : thisReduceOrder , docCountError , otherDocCount [ 0 ] );
337+ return create (name , result , reduceContext .isFinalReduce () ? getOrder () : thisReduceOrder , docCountError , otherDocCount );
338338 }
339339
340340 private BucketOrder getThisReduceOrder () {
0 commit comments