@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers = null;
boolean cache = true;
PublicTermsFilter termsFilter = new PublicTermsFilter();
String filterName = null;
String currentFieldName = null;
CacheKeyFilter.Key cacheKey = null;
XContentParser.Token token;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == XContentParser.Token.START_ARRAY) {
String fieldName = currentFieldName;
FieldMapper fieldMapper = null;
smartNameFieldMappers = parseContext.smartFieldMappers(fieldName);
if (smartNameFieldMappers != null) {
if (smartNameFieldMappers.hasMapper()) {
fieldMapper = smartNameFieldMappers.mapper();
fieldName = fieldMapper.names().indexName();
}
}
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
String value = parser.text();
if (value == null) {
throw new QueryParsingException(parseContext.index(), "No value specified for term filter");
}
if (fieldMapper != null) {
value = fieldMapper.indexedValue(value);
}
termsFilter.addTerm(new Term(fieldName, value));
}
} else if (token.isValue()) {
if ("_name".equals(currentFieldName)) {
filterName = parser.text();
} else if ("_cache".equals(currentFieldName)) {