File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
server/src/main/java/org/opensearch/search/aggregations/bucket/composite Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -165,16 +165,15 @@ BytesRef toComparable(int slot) throws IOException {
165
165
166
166
@ Override
167
167
LeafBucketCollector getLeafCollector (LeafReaderContext context , LeafBucketCollector next ) throws IOException {
168
- // Get the DocValues for this segment/leaf of the index
169
168
final SortedSetDocValues dvs = docValuesFunc .apply (context );
170
-
171
- // Initialize lookup table for ordinals if not already done
172
169
if (lookup == null ) {
173
170
initLookup (dvs );
174
171
}
175
172
173
+ // unwrapSingleton() returns non-null only if the field is single-valued
176
174
final SortedDocValues singleton = DocValues .unwrapSingleton (dvs );
177
175
176
+ // Optimization path: Field is confirmed to be single-valued
178
177
if (singleton != null ) {
179
178
return new LeafBucketCollector () {
180
179
@ Override
You can’t perform that action at this time.
0 commit comments