Skip to content

Commit

Permalink
Mappings: Fix exists filter on 1.x to check enabled() on _field_names.
Browse files Browse the repository at this point in the history
This is a follow up to elastic#10268.
  • Loading branch information
rjernst committed Mar 25, 2015
1 parent bd16117 commit 314ee9c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public Filter parse(QueryParseContext parseContext) throws IOException, QueryPar
}

public static Filter newFilter(QueryParseContext parseContext, String fieldPattern, String filterName) {
final FieldMappers fieldNamesMapper = parseContext.mapperService().indexName(FieldNamesFieldMapper.CONTENT_TYPE);
final FieldMappers fieldNamesMappers = parseContext.mapperService().indexName(FieldNamesFieldMapper.NAME);
final FieldNamesFieldMapper fieldNamesMapper = (FieldNamesFieldMapper)fieldNamesMappers.mapper();

MapperService.SmartNameObjectMapper smartNameObjectMapper = parseContext.smartObjectMapper(fieldPattern);
if (smartNameObjectMapper != null && smartNameObjectMapper.hasMapper()) {
Expand All @@ -105,14 +106,14 @@ public static Filter newFilter(QueryParseContext parseContext, String fieldPatte
nonNullFieldMappers = smartNameFieldMappers;
}
Filter filter = null;
if (fieldNamesMapper!= null && fieldNamesMapper.mapper().fieldType().indexed()) {
if (fieldNamesMapper!= null && fieldNamesMapper.enabled()) {
final String f;
if (smartNameFieldMappers != null && smartNameFieldMappers.hasMapper()) {
f = smartNameFieldMappers.mapper().names().indexName();
} else {
f = field;
}
filter = fieldNamesMapper.mapper().termFilter(f, parseContext);
filter = fieldNamesMapper.termFilter(f, parseContext);
}
// if _field_names are not indexed, we need to go the slow way
if (filter == null && smartNameFieldMappers != null && smartNameFieldMappers.hasMapper()) {
Expand Down

0 comments on commit 314ee9c

Please sign in to comment.