@Override
protected XContentBuilder internalXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
if (keyedFilters == null && nonKeyedFilters == null) {
throw new SearchSourceBuilderException("At least one filter must be set on filter aggregation [" + getName() + "]");
}
if (keyedFilters != null && nonKeyedFilters != null) {
throw new SearchSourceBuilderException("Cannot add both keyed and non-keyed filters to filters aggregation");
}
if (keyedFilters != null) {
builder.startObject("filters");
for (Map.Entry<String, FilterBuilder> entry : keyedFilters.entrySet()) {