AggregationBuilder aggregationBuilder = AggregationBuilders.terms("Frequency").
field("fieldName").minDocCount(1).size(Integer.MAX_VALUE);
aggregationBuilder.subAggregation(AggregationBuilders.count("count"));
PipelineAggregationBuilder pipelineAggregationBuilder = PipelineAggregatorBuilders.
statsBucket("extended_stats_bucket", "Frequency>count");
SearchRequest searchRequest = new SearchRequest("indexName");
searchRequest.types(indexType);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.aggregation(aggregationBuilder);
searchSourceBuilder.aggregation(pipelineAggregationBuilder);
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = highLevelClient.search(searchRequest);
getting below error
ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_state_exception, reason=value source config is inv alid; must have either a field context or a script or marked as unwrapped]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_state_exception, reason=value source config is invalid; must have either a field context or a script or marked as unwrapped]];**