ES java api for multiple aggregations at same level

Hi All,

Could you please help me on how to convert below dsl to java api using aggregationbuilders,

{
	"aggs": {
		"status_aggr": {
			"terms": {
				"field": "status",
				"size": 15,
				"order": {
					"_count": "desc"
				}
			}
		},
		"status_Not_Available": {
			"missing": {
				"field": "status"
			}
		},
		"status_Available": {
			"value_count": {
				"field": "status"
			}
		}
	}
}

Thanks,
Prasad G

1 Like

Read https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high-search.html#java-rest-high-document-search-request-building-aggs

You can call:

searchSourceBuilder.aggregation(agg1);
searchSourceBuilder.aggregation(agg2);
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.