logger.info("--> checking single filtering alias search with global facets");
searchResponse = client().prepareSearch("tests").setQuery(QueryBuilders.matchQuery("name", "bar"))
.addAggregation(AggregationBuilders.global("global").subAggregation(AggregationBuilders.terms("test").field("name")))
.get();
assertSearchResponse(searchResponse);
Global global = searchResponse.getAggregations().get("global");
Terms terms = global.getAggregations().get("test");
assertThat(terms.getBuckets().size(), equalTo(4));
logger.info("--> checking single filtering alias search with global facets and sort");
searchResponse = client().prepareSearch("tests").setQuery(QueryBuilders.matchQuery("name", "bar"))
.addAggregation(AggregationBuilders.global("global").subAggregation(AggregationBuilders.terms("test").field("name")))
.addSort("_uid", SortOrder.ASC).get();
assertSearchResponse(searchResponse);
global = searchResponse.getAggregations().get("global");
terms = global.getAggregations().get("test");
assertThat(terms.getBuckets().size(), equalTo(4));
logger.info("--> checking single filtering alias search with non-global facets");
searchResponse = client().prepareSearch("tests").setQuery(QueryBuilders.matchQuery("name", "bar"))
.addAggregation(AggregationBuilders.terms("test").field("name"))