Skip to content

Commit

Permalink
Change wildcard and constant_keyword fields to return keyword f…
Browse files Browse the repository at this point in the history
…or field capabilities.

Relates to elastic#53175
  • Loading branch information
markharwood committed Jun 24, 2020
1 parent cca23aa commit 4fb5146
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ private FieldCapabilitiesIndexResponse shardOperation(final FieldCapabilitiesInd
if (ft != null) {
if (indicesService.isMetadataField(mapperService.getIndexSettings().getIndexVersionCreated(), field)
|| fieldPredicate.test(ft.name())) {
IndexFieldCapabilities fieldCap = new IndexFieldCapabilities(field, ft.typeName(),
IndexFieldCapabilities fieldCap = new IndexFieldCapabilities(field, ft.familyTypeName(),
ft.isSearchable(), ft.isAggregatable(), ft.meta());
responseMap.put(field, fieldCap);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ public int hashCode() {

/** Returns the name of this type, as would be specified in mapping properties */
public abstract String typeName();

/** Returns the field family type, as used in field capabilities */
public String familyTypeName() {
return typeName();
}

public String name() {
return name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.elasticsearch.index.fielddata.plain.ConstantIndexFieldData;
import org.elasticsearch.index.mapper.ConstantFieldType;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.KeywordFieldMapper;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MapperParsingException;
Expand Down Expand Up @@ -151,6 +152,11 @@ public String value() {
public String typeName() {
return CONTENT_TYPE;
}

@Override
public String familyTypeName() {
return KeywordFieldMapper.CONTENT_TYPE;
}

@Override
public IndexFieldData.Builder fielddataBuilder(String fullyQualifiedIndexName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import org.elasticsearch.index.fielddata.plain.StringBinaryIndexFieldData;
import org.elasticsearch.index.mapper.BinaryFieldMapper.CustomBinaryDocValuesField;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.index.mapper.KeywordFieldMapper;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.mapper.Mapper;
import org.elasticsearch.index.mapper.MapperParsingException;
Expand Down Expand Up @@ -848,6 +849,12 @@ public Query fuzzyQuery(
public String typeName() {
return CONTENT_TYPE;
}

@Override
public String familyTypeName() {
return KeywordFieldMapper.CONTENT_TYPE;
}


@Override
public Query existsQuery(QueryShardContext context) {
Expand Down

0 comments on commit 4fb5146

Please sign in to comment.