Skip to content

Follow up on HSEARCH-3661 Use aggregations key more consistently #4725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
public abstract class AbstractElasticsearchBucketAggregation<K, V>
extends AbstractElasticsearchNestableAggregation<Map<K, V>> {

protected static final JsonAccessor<JsonObject> REQUEST_AGGREGATIONS_ACCESSOR =
JsonAccessor.root().property( "aggregations" ).asObject();

private static final JsonAccessor<JsonObject> REQUEST_REVERSE_NESTED_ACCESSOR =
JsonAccessor.root().property( "reverse_nested" ).asObject();

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

protected static final String INNER_EXTRACTOR_KEY = "innerExtractorKey";
protected static final String INNER_EXTRACTOR = "innerExtractor";

AbstractElasticsearchBucketAggregation(AbstractBuilder<K, V> builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected void doRequest(JsonObject outerObject, JsonObject innerObject, Aggrega
aggregation.request( context, AggregationKey.of( "agg" ), subOuterObject ) );

if ( !subOuterObject.isEmpty() ) {
outerObject.add( "aggs", subOuterObject );
REQUEST_AGGREGATIONS_ACCESSOR.set( outerObject, subOuterObject );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void doRequest(JsonObject outerObject, JsonObject innerObject, Aggrega
aggregation.request( context, AggregationKey.of( "agg" ), subOuterObject ) );

if ( !subOuterObject.isEmpty() ) {
outerObject.add( "aggs", subOuterObject );
REQUEST_AGGREGATIONS_ACCESSOR.set( outerObject, subOuterObject );
}
}

Expand Down