String query = copyToStringFromClasspath("/org/elasticsearch/index/query/geo_boundingbox-named.json");
ParsedQuery parsedQuery = queryParser.parse(query);
assertThat(parsedQuery.query(), instanceOf(ConstantScoreQuery.class));
assertThat(parsedQuery.namedFilters().containsKey("test"), equalTo(true));
ConstantScoreQuery constantScoreQuery = (ConstantScoreQuery) parsedQuery.query();
InMemoryGeoBoundingBoxFilter filter = (InMemoryGeoBoundingBoxFilter) constantScoreQuery.getFilter();
assertThat(filter.fieldName(), equalTo("location"));
assertThat(filter.topLeft().lat(), closeTo(40, 0.00001));
assertThat(filter.topLeft().lon(), closeTo(-70, 0.00001));
assertThat(filter.bottomRight().lat(), closeTo(30, 0.00001));
assertThat(filter.bottomRight().lon(), closeTo(-80, 0.00001));
}