Skip to content

Commit 80b7ee4

Browse files
committed
HSEARCH-3661 Use aggregations key more consistently
e.g. instead of `aggs` in bucket aggregations
1 parent 5ed6936 commit 80b7ee4

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/search/aggregation/impl/AbstractElasticsearchBucketAggregation.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@
2323
public abstract class AbstractElasticsearchBucketAggregation<K, V>
2424
extends AbstractElasticsearchNestableAggregation<Map<K, V>> {
2525

26+
protected static final JsonAccessor<JsonObject> REQUEST_AGGREGATIONS_ACCESSOR =
27+
JsonAccessor.root().property( "aggregations" ).asObject();
28+
2629
private static final JsonAccessor<JsonObject> REQUEST_REVERSE_NESTED_ACCESSOR =
2730
JsonAccessor.root().property( "reverse_nested" ).asObject();
2831

2932
private static final String ROOT_DOC_COUNT_NAME = "root_doc_count";
3033
private static final JsonAccessor<JsonObject> REQUEST_AGGREGATIONS_ROOT_DOC_COUNT_ACCESSOR =
3134
JsonAccessor.root().property( "aggregations" ).property( ROOT_DOC_COUNT_NAME ).asObject();
3235

33-
protected static final String INNER_EXTRACTOR_KEY = "innerExtractorKey";
3436
protected static final String INNER_EXTRACTOR = "innerExtractor";
3537

3638
AbstractElasticsearchBucketAggregation(AbstractBuilder<K, V> builder) {

backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/search/aggregation/impl/ElasticsearchRangeAggregation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected void doRequest(JsonObject outerObject, JsonObject innerObject, Aggrega
6666
aggregation.request( context, AggregationKey.of( "agg" ), subOuterObject ) );
6767

6868
if ( !subOuterObject.isEmpty() ) {
69-
outerObject.add( "aggs", subOuterObject );
69+
REQUEST_AGGREGATIONS_ACCESSOR.set( outerObject, subOuterObject );
7070
}
7171
}
7272

backend/elasticsearch/src/main/java/org/hibernate/search/backend/elasticsearch/search/aggregation/impl/ElasticsearchTermsAggregation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ protected void doRequest(JsonObject outerObject, JsonObject innerObject, Aggrega
7272
aggregation.request( context, AggregationKey.of( "agg" ), subOuterObject ) );
7373

7474
if ( !subOuterObject.isEmpty() ) {
75-
outerObject.add( "aggs", subOuterObject );
75+
REQUEST_AGGREGATIONS_ACCESSOR.set( outerObject, subOuterObject );
7676
}
7777
}
7878

0 commit comments

Comments
 (0)