more cleanup in mappings
This commit is contained in:
parent
1867ef5084
commit
ac253178bd
|
@ -197,18 +197,18 @@ public class ShardGetService extends AbstractIndexShardComponent {
|
|||
continue;
|
||||
}
|
||||
Object value = null;
|
||||
if (field.equals(RoutingFieldMapper.NAME) && docMapper.routingFieldMapper().stored()) {
|
||||
if (field.equals(RoutingFieldMapper.NAME) && docMapper.routingFieldMapper().fieldType().stored()) {
|
||||
value = source.routing;
|
||||
} else if (field.equals(ParentFieldMapper.NAME) && docMapper.parentFieldMapper() != null && docMapper.parentFieldMapper().stored()) {
|
||||
} else if (field.equals(ParentFieldMapper.NAME) && docMapper.parentFieldMapper() != null && docMapper.parentFieldMapper().fieldType().stored()) {
|
||||
value = source.parent;
|
||||
} else if (field.equals(TimestampFieldMapper.NAME) && docMapper.timestampFieldMapper().stored()) {
|
||||
} else if (field.equals(TimestampFieldMapper.NAME) && docMapper.timestampFieldMapper().fieldType().stored()) {
|
||||
value = source.timestamp;
|
||||
} else if (field.equals(TTLFieldMapper.NAME) && docMapper.TTLFieldMapper().stored()) {
|
||||
} else if (field.equals(TTLFieldMapper.NAME) && docMapper.TTLFieldMapper().fieldType().stored()) {
|
||||
// Call value for search with timestamp + ttl here to display the live remaining ttl value and be consistent with the search result display
|
||||
if (source.ttl > 0) {
|
||||
value = docMapper.TTLFieldMapper().valueForSearch(source.timestamp + source.ttl);
|
||||
}
|
||||
} else if (field.equals(SizeFieldMapper.NAME) && docMapper.rootMapper(SizeFieldMapper.class).stored()) {
|
||||
} else if (field.equals(SizeFieldMapper.NAME) && docMapper.rootMapper(SizeFieldMapper.class).fieldType().stored()) {
|
||||
value = source.source.length();
|
||||
} else {
|
||||
if (field.contains("_source.")) {
|
||||
|
@ -242,7 +242,7 @@ public class ShardGetService extends AbstractIndexShardComponent {
|
|||
|
||||
FieldMapper<?> x = docMapper.mappers().smartNameFieldMapper(field);
|
||||
// only if the field is stored or source is enabled we should add it..
|
||||
if (docMapper.sourceMapper().enabled() || x == null || x.stored()) {
|
||||
if (docMapper.sourceMapper().enabled() || x == null || x.fieldType().stored()) {
|
||||
value = searchLookup.source().extractValue(field);
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +318,7 @@ public class ShardGetService extends AbstractIndexShardComponent {
|
|||
}
|
||||
} else {
|
||||
FieldMappers x = docMapper.mappers().smartName(field);
|
||||
if (x == null || !x.mapper().stored()) {
|
||||
if (x == null || !x.mapper().fieldType().stored()) {
|
||||
if (searchLookup == null) {
|
||||
searchLookup = new SearchLookup(mapperService, indexCache.fieldData(), new String[]{type});
|
||||
searchLookup.setNextReader(docIdAndVersion.reader);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
package org.elasticsearch.index.mapper;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.Filter;
|
||||
import org.apache.lucene.search.MultiTermQuery;
|
||||
|
@ -120,26 +120,10 @@ public interface FieldMapper<T> {
|
|||
|
||||
// LUCENE 4 UPGRADE Consider replacing these all with fieldType() and letting consumer pick and choose
|
||||
|
||||
boolean indexed();
|
||||
|
||||
boolean tokenized();
|
||||
|
||||
boolean stored();
|
||||
|
||||
boolean storeTermVectors();
|
||||
|
||||
boolean storeTermVectorOffsets();
|
||||
|
||||
boolean storeTermVectorPositions();
|
||||
|
||||
boolean storeTermVectorPayloads();
|
||||
FieldType fieldType();
|
||||
|
||||
float boost();
|
||||
|
||||
boolean omitNorms();
|
||||
|
||||
IndexOptions indexOptions();
|
||||
|
||||
/**
|
||||
* The analyzer that will be used to index the field.
|
||||
*/
|
||||
|
|
|
@ -442,7 +442,7 @@ public class MapperService extends AbstractIndexComponent implements Iterable<Do
|
|||
useTermsFilter = false;
|
||||
break;
|
||||
}
|
||||
if (!docMapper.typeMapper().indexed()) {
|
||||
if (!docMapper.typeMapper().fieldType().indexed()) {
|
||||
useTermsFilter = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ public class ParseContext {
|
|||
}
|
||||
|
||||
public boolean includeInAll(Boolean includeInAll, FieldMapper mapper) {
|
||||
return includeInAll(includeInAll, mapper.indexed());
|
||||
return includeInAll(includeInAll, mapper.fieldType().indexed());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -311,38 +311,8 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
|||
public abstract FieldType defaultFieldType();
|
||||
|
||||
@Override
|
||||
public boolean stored() {
|
||||
return fieldType.stored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean indexed() {
|
||||
return fieldType.indexed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean tokenized() {
|
||||
return fieldType.tokenized();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storeTermVectors() {
|
||||
return fieldType.storeTermVectors();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storeTermVectorOffsets() {
|
||||
return fieldType.storeTermVectorOffsets();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storeTermVectorPositions() {
|
||||
return fieldType.storeTermVectorPositions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean storeTermVectorPayloads() {
|
||||
return fieldType.storeTermVectorPayloads();
|
||||
public FieldType fieldType() {
|
||||
return fieldType;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -350,16 +320,6 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
|||
return this.boost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean omitNorms() {
|
||||
return fieldType.omitNorms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexOptions indexOptions() {
|
||||
return fieldType.indexOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Analyzer indexAnalyzer() {
|
||||
return this.indexAnalyzer;
|
||||
|
@ -526,25 +486,25 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
|||
return;
|
||||
}
|
||||
AbstractFieldMapper fieldMergeWith = (AbstractFieldMapper) mergeWith;
|
||||
if (this.indexed() != fieldMergeWith.indexed() || this.tokenized() != fieldMergeWith.tokenized()) {
|
||||
if (this.fieldType().indexed() != fieldMergeWith.fieldType().indexed() || this.fieldType().tokenized() != fieldMergeWith.fieldType().tokenized()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different index values");
|
||||
}
|
||||
if (this.stored() != fieldMergeWith.stored()) {
|
||||
if (this.fieldType().stored() != fieldMergeWith.fieldType().stored()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different store values");
|
||||
}
|
||||
if (this.tokenized() != fieldMergeWith.tokenized()) {
|
||||
if (this.fieldType().tokenized() != fieldMergeWith.fieldType().tokenized()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different tokenize values");
|
||||
}
|
||||
if (this.storeTermVectors() != fieldMergeWith.storeTermVectors()) {
|
||||
if (this.fieldType().storeTermVectors() != fieldMergeWith.fieldType().storeTermVectors()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different store_term_vector values");
|
||||
}
|
||||
if (this.storeTermVectorOffsets() != fieldMergeWith.storeTermVectorOffsets()) {
|
||||
if (this.fieldType().storeTermVectorOffsets() != fieldMergeWith.fieldType().storeTermVectorOffsets()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different store_term_vector_offsets values");
|
||||
}
|
||||
if (this.storeTermVectorPositions() != fieldMergeWith.storeTermVectorPositions()) {
|
||||
if (this.fieldType().storeTermVectorPositions() != fieldMergeWith.fieldType().storeTermVectorPositions()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different store_term_vector_positions values");
|
||||
}
|
||||
if (this.storeTermVectorPayloads() != fieldMergeWith.storeTermVectorPayloads()) {
|
||||
if (this.fieldType().storeTermVectorPayloads() != fieldMergeWith.fieldType().storeTermVectorPayloads()) {
|
||||
mergeContext.addConflict("mapper [" + names.fullName() + "] has different store_term_vector_payloads values");
|
||||
}
|
||||
if (this.indexAnalyzer == null) {
|
||||
|
@ -614,30 +574,30 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
|||
}
|
||||
|
||||
FieldType defaultFieldType = defaultFieldType();
|
||||
if (indexed() != defaultFieldType.indexed() ||
|
||||
tokenized() != defaultFieldType.tokenized()) {
|
||||
builder.field("index", indexTokenizeOptionToString(indexed(), tokenized()));
|
||||
if (fieldType.indexed() != defaultFieldType.indexed() ||
|
||||
fieldType.tokenized() != defaultFieldType.tokenized()) {
|
||||
builder.field("index", indexTokenizeOptionToString(fieldType.indexed(), fieldType.tokenized()));
|
||||
}
|
||||
if (stored() != defaultFieldType.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType.stored() != defaultFieldType.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
}
|
||||
if (storeTermVectors() != defaultFieldType.storeTermVectors()) {
|
||||
builder.field("store_term_vector", storeTermVectors());
|
||||
if (fieldType.storeTermVectors() != defaultFieldType.storeTermVectors()) {
|
||||
builder.field("store_term_vector", fieldType.storeTermVectors());
|
||||
}
|
||||
if (storeTermVectorOffsets() != defaultFieldType.storeTermVectorOffsets()) {
|
||||
builder.field("store_term_vector_offsets", storeTermVectorOffsets());
|
||||
if (fieldType.storeTermVectorOffsets() != defaultFieldType.storeTermVectorOffsets()) {
|
||||
builder.field("store_term_vector_offsets", fieldType.storeTermVectorOffsets());
|
||||
}
|
||||
if (storeTermVectorPositions() != defaultFieldType.storeTermVectorPositions()) {
|
||||
builder.field("store_term_vector_positions", storeTermVectorPositions());
|
||||
if (fieldType.storeTermVectorPositions() != defaultFieldType.storeTermVectorPositions()) {
|
||||
builder.field("store_term_vector_positions", fieldType.storeTermVectorPositions());
|
||||
}
|
||||
if (storeTermVectorPayloads() != defaultFieldType.storeTermVectorPayloads()) {
|
||||
builder.field("store_term_vector_payloads", storeTermVectorPayloads());
|
||||
if (fieldType.storeTermVectorPayloads() != defaultFieldType.storeTermVectorPayloads()) {
|
||||
builder.field("store_term_vector_payloads", fieldType.storeTermVectorPayloads());
|
||||
}
|
||||
if (omitNorms() != defaultFieldType.omitNorms()) {
|
||||
builder.field("omit_norms", omitNorms());
|
||||
if (fieldType.omitNorms() != defaultFieldType.omitNorms()) {
|
||||
builder.field("omit_norms", fieldType.omitNorms());
|
||||
}
|
||||
if (indexOptions() != defaultFieldType.indexOptions()) {
|
||||
builder.field("index_options", indexOptionToString(indexOptions()));
|
||||
if (fieldType.indexOptions() != defaultFieldType.indexOptions()) {
|
||||
builder.field("index_options", indexOptionToString(fieldType.indexOptions()));
|
||||
}
|
||||
|
||||
if (indexAnalyzer != null && searchAnalyzer != null && indexAnalyzer.name().equals(searchAnalyzer.name()) && !indexAnalyzer.name().startsWith("_") && !indexAnalyzer.name().equals("default")) {
|
||||
|
|
|
@ -163,7 +163,7 @@ public class BinaryFieldMapper extends AbstractFieldMapper<byte[]> {
|
|||
|
||||
@Override
|
||||
protected Field parseCreateField(ParseContext context) throws IOException {
|
||||
if (!stored()) {
|
||||
if (!fieldType().stored()) {
|
||||
return null;
|
||||
}
|
||||
byte[] value;
|
||||
|
|
|
@ -203,7 +203,7 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
|
|||
|
||||
@Override
|
||||
protected Field parseCreateField(ParseContext context) throws IOException {
|
||||
if (!indexed() && !stored()) {
|
||||
if (!fieldType().indexed() && !fieldType().stored()) {
|
||||
return null;
|
||||
}
|
||||
XContentParser.Token token = context.parser().currentToken();
|
||||
|
|
|
@ -354,7 +354,7 @@ public class ByteFieldMapper extends NumberFieldMapper<Byte> {
|
|||
private final NumberFieldMapper mapper;
|
||||
|
||||
public CustomByteNumericField(NumberFieldMapper mapper, byte number, FieldType fieldType) {
|
||||
super(mapper, mapper.stored() ? new byte[]{number} : null, fieldType);
|
||||
super(mapper, mapper.fieldType.stored() ? new byte[]{number} : null, fieldType);
|
||||
this.mapper = mapper;
|
||||
this.number = number;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ public class DoubleFieldMapper extends NumberFieldMapper<Double> {
|
|||
private final NumberFieldMapper mapper;
|
||||
|
||||
public CustomDoubleNumericField(NumberFieldMapper mapper, double number, FieldType fieldType) {
|
||||
super(mapper, mapper.stored() ? Numbers.doubleToBytes(number) : null, fieldType);
|
||||
super(mapper, mapper.fieldType().stored() ? Numbers.doubleToBytes(number) : null, fieldType);
|
||||
this.mapper = mapper;
|
||||
this.number = number;
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ public class FloatFieldMapper extends NumberFieldMapper<Float> {
|
|||
private final NumberFieldMapper mapper;
|
||||
|
||||
public CustomFloatNumericField(NumberFieldMapper mapper, float number, FieldType fieldType) {
|
||||
super(mapper, mapper.stored() ? Numbers.floatToBytes(number) : null, fieldType);
|
||||
super(mapper, mapper.fieldType().stored() ? Numbers.floatToBytes(number) : null, fieldType);
|
||||
this.mapper = mapper;
|
||||
this.number = number;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ public class IntegerFieldMapper extends NumberFieldMapper<Integer> {
|
|||
private final NumberFieldMapper mapper;
|
||||
|
||||
public CustomIntegerNumericField(NumberFieldMapper mapper, int number, FieldType fieldType) {
|
||||
super(mapper, mapper.stored() ? Numbers.intToBytes(number) : null, fieldType);
|
||||
super(mapper, mapper.fieldType().stored() ? Numbers.intToBytes(number) : null, fieldType);
|
||||
this.mapper = mapper;
|
||||
this.number = number;
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ public class LongFieldMapper extends NumberFieldMapper<Long> {
|
|||
private final NumberFieldMapper mapper;
|
||||
|
||||
public CustomLongNumericField(NumberFieldMapper mapper, long number, FieldType fieldType) {
|
||||
super(mapper, mapper.stored() ? Numbers.longToBytes(number) : null, fieldType);
|
||||
super(mapper, mapper.fieldType.stored() ? Numbers.longToBytes(number) : null, fieldType);
|
||||
this.mapper = mapper;
|
||||
this.number = number;
|
||||
}
|
||||
|
|
|
@ -356,7 +356,7 @@ public class ShortFieldMapper extends NumberFieldMapper<Short> {
|
|||
private final NumberFieldMapper mapper;
|
||||
|
||||
public CustomShortNumericField(NumberFieldMapper mapper, short number, FieldType fieldType) {
|
||||
super(mapper, mapper.stored() ? Numbers.shortToBytes(number) : null, fieldType);
|
||||
super(mapper, mapper.fieldType().stored() ? Numbers.shortToBytes(number) : null, fieldType);
|
||||
this.mapper = mapper;
|
||||
this.number = number;
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
|||
if (context.includeInAll(includeInAll, this)) {
|
||||
context.allEntries().addText(names.fullName(), value, boost);
|
||||
}
|
||||
if (!indexed() && !stored()) {
|
||||
if (!fieldType().indexed() && !fieldType().stored()) {
|
||||
context.ignoredValue(names.indexName(), value);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -502,8 +502,8 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser {
|
|||
if (enableGeoHash != Defaults.ENABLE_GEOHASH) {
|
||||
builder.field("geohash", enableGeoHash);
|
||||
}
|
||||
if (geoStringMapper.stored() != Defaults.STORE) {
|
||||
builder.field("store", geoStringMapper.stored());
|
||||
if (geoStringMapper.fieldType().stored() != Defaults.STORE) {
|
||||
builder.field("store", geoStringMapper.fieldType().stored());
|
||||
}
|
||||
if (precision != Defaults.PRECISION) {
|
||||
builder.field("geohash_precision", precision);
|
||||
|
|
|
@ -253,8 +253,8 @@ public class AllFieldMapper extends AbstractFieldMapper<Void> implements Interna
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
// if all are defaults, no need to write it at all
|
||||
if (enabled == Defaults.ENABLED && stored() == Defaults.FIELD_TYPE.stored() &&
|
||||
storeTermVectors() == Defaults.FIELD_TYPE.storeTermVectors() &&
|
||||
if (enabled == Defaults.ENABLED && fieldType.stored() == Defaults.FIELD_TYPE.stored() &&
|
||||
fieldType.storeTermVectors() == Defaults.FIELD_TYPE.storeTermVectors() &&
|
||||
indexAnalyzer == null && searchAnalyzer == null) {
|
||||
return builder;
|
||||
}
|
||||
|
@ -265,20 +265,20 @@ public class AllFieldMapper extends AbstractFieldMapper<Void> implements Interna
|
|||
if (autoBoost != false) {
|
||||
builder.field("auto_boost", autoBoost);
|
||||
}
|
||||
if (stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
}
|
||||
if (storeTermVectors() != Defaults.FIELD_TYPE.storeTermVectors()) {
|
||||
builder.field("store_term_vector", storeTermVectors());
|
||||
if (fieldType.storeTermVectors() != Defaults.FIELD_TYPE.storeTermVectors()) {
|
||||
builder.field("store_term_vector", fieldType.storeTermVectors());
|
||||
}
|
||||
if (storeTermVectorOffsets() != Defaults.FIELD_TYPE.storeTermVectorOffsets()) {
|
||||
builder.field("store_term_vector_offsets", storeTermVectorOffsets());
|
||||
if (fieldType.storeTermVectorOffsets() != Defaults.FIELD_TYPE.storeTermVectorOffsets()) {
|
||||
builder.field("store_term_vector_offsets", fieldType.storeTermVectorOffsets());
|
||||
}
|
||||
if (storeTermVectorPositions() != Defaults.FIELD_TYPE.storeTermVectorPositions()) {
|
||||
builder.field("store_term_vector_positions", storeTermVectorPositions());
|
||||
if (fieldType.storeTermVectorPositions() != Defaults.FIELD_TYPE.storeTermVectorPositions()) {
|
||||
builder.field("store_term_vector_positions", fieldType.storeTermVectorPositions());
|
||||
}
|
||||
if (storeTermVectorPayloads() != Defaults.FIELD_TYPE.storeTermVectorPayloads()) {
|
||||
builder.field("store_term_vector_payloads", storeTermVectorPayloads());
|
||||
if (fieldType.storeTermVectorPayloads() != Defaults.FIELD_TYPE.storeTermVectorPayloads()) {
|
||||
builder.field("store_term_vector_payloads", fieldType.storeTermVectorPayloads());
|
||||
}
|
||||
if (indexAnalyzer != null && searchAnalyzer != null && indexAnalyzer.name().equals(searchAnalyzer.name()) && !indexAnalyzer.name().startsWith("_")) {
|
||||
// same analyzers, output it once
|
||||
|
|
|
@ -155,7 +155,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
|||
|
||||
@Override
|
||||
public Query fieldQuery(String value, @Nullable QueryParseContext context) {
|
||||
if (indexed() || context == null) {
|
||||
if (fieldType.indexed() || context == null) {
|
||||
return super.fieldQuery(value, context);
|
||||
}
|
||||
UidFilter filter = new UidFilter(context.queryTypes(), ImmutableList.of(value));
|
||||
|
@ -165,7 +165,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
|||
|
||||
@Override
|
||||
public Filter fieldFilter(String value, @Nullable QueryParseContext context) {
|
||||
if (indexed() || context == null) {
|
||||
if (fieldType.indexed() || context == null) {
|
||||
return super.fieldFilter(value, context);
|
||||
}
|
||||
return new UidFilter(context.queryTypes(), ImmutableList.of(value));
|
||||
|
@ -173,7 +173,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
|||
|
||||
@Override
|
||||
public Query prefixQuery(String value, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
|
||||
if (indexed() || context == null) {
|
||||
if (fieldType.indexed() || context == null) {
|
||||
return super.prefixQuery(value, method, context);
|
||||
}
|
||||
Collection<String> queryTypes = context.queryTypes();
|
||||
|
@ -197,7 +197,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
|||
|
||||
@Override
|
||||
public Filter prefixFilter(String value, @Nullable QueryParseContext context) {
|
||||
if (indexed() || context == null) {
|
||||
if (fieldType.indexed() || context == null) {
|
||||
return super.prefixFilter(value, context);
|
||||
}
|
||||
Collection<String> queryTypes = context.queryTypes();
|
||||
|
@ -213,7 +213,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
|||
|
||||
@Override
|
||||
public Query regexpQuery(String value, int flags, @Nullable MultiTermQuery.RewriteMethod method, @Nullable QueryParseContext context) {
|
||||
if (indexed() || context == null) {
|
||||
if (fieldType.indexed() || context == null) {
|
||||
return super.regexpQuery(value, flags, method, context);
|
||||
}
|
||||
Collection<String> queryTypes = context.queryTypes();
|
||||
|
@ -236,7 +236,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
|||
}
|
||||
|
||||
public Filter regexpFilter(String value, int flags, @Nullable QueryParseContext context) {
|
||||
if (indexed() || context == null) {
|
||||
if (fieldType.indexed() || context == null) {
|
||||
return super.regexpFilter(value, flags, context);
|
||||
}
|
||||
Collection<String> queryTypes = context.queryTypes();
|
||||
|
|
|
@ -186,12 +186,12 @@ public class IndexFieldMapper extends AbstractFieldMapper<String> implements Int
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
// if all defaults, no need to write it at all
|
||||
if (stored() == Defaults.FIELD_TYPE.stored() && enabled == Defaults.ENABLED) {
|
||||
if (fieldType().stored() == Defaults.FIELD_TYPE.stored() && enabled == Defaults.ENABLED) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType().stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
if (enabled != Defaults.ENABLED) {
|
||||
builder.field("enabled", enabled);
|
||||
|
|
|
@ -207,7 +207,7 @@ public class RoutingFieldMapper extends AbstractFieldMapper<String> implements I
|
|||
if (context.sourceToParse().routing() != null) {
|
||||
String routing = context.sourceToParse().routing();
|
||||
if (routing != null) {
|
||||
if (!indexed() && !stored()) {
|
||||
if (!fieldType.indexed() && !fieldType.stored()) {
|
||||
context.ignoredValue(names.indexName(), routing);
|
||||
return null;
|
||||
}
|
||||
|
@ -226,16 +226,16 @@ public class RoutingFieldMapper extends AbstractFieldMapper<String> implements I
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
// if all are defaults, no sense to write it at all
|
||||
if (indexed() == Defaults.FIELD_TYPE.indexed() &&
|
||||
stored() == Defaults.FIELD_TYPE.stored() && required == Defaults.REQUIRED && path == Defaults.PATH) {
|
||||
if (fieldType.indexed() == Defaults.FIELD_TYPE.indexed() &&
|
||||
fieldType.stored() == Defaults.FIELD_TYPE.stored() && required == Defaults.REQUIRED && path == Defaults.PATH) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (indexed() != Defaults.FIELD_TYPE.indexed()) {
|
||||
builder.field("index", indexed());
|
||||
if (fieldType.indexed() != Defaults.FIELD_TYPE.indexed()) {
|
||||
builder.field("index", fieldType.indexed());
|
||||
}
|
||||
if (stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
}
|
||||
if (required != Defaults.REQUIRED) {
|
||||
builder.field("required", required);
|
||||
|
|
|
@ -151,15 +151,15 @@ public class SizeFieldMapper extends IntegerFieldMapper implements RootMapper {
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
// all are defaults, no need to write it at all
|
||||
if (enabled == Defaults.ENABLED && stored() == Defaults.SIZE_FIELD_TYPE.stored()) {
|
||||
if (enabled == Defaults.ENABLED && fieldType().stored() == Defaults.SIZE_FIELD_TYPE.stored()) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(contentType());
|
||||
if (enabled != Defaults.ENABLED) {
|
||||
builder.field("enabled", enabled);
|
||||
}
|
||||
if (stored() != Defaults.SIZE_FIELD_TYPE.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType().stored() != Defaults.SIZE_FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -245,7 +245,7 @@ public class SourceFieldMapper extends AbstractFieldMapper<byte[]> implements In
|
|||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
if (!stored()) {
|
||||
if (!fieldType.stored()) {
|
||||
return null;
|
||||
}
|
||||
if (context.flyweight()) {
|
||||
|
|
|
@ -206,7 +206,7 @@ public class TimestampFieldMapper extends DateFieldMapper implements InternalMap
|
|||
protected Field innerParseCreateField(ParseContext context) throws IOException {
|
||||
if (enabled) {
|
||||
long timestamp = context.sourceToParse().timestamp();
|
||||
if (!indexed() && !stored()) {
|
||||
if (!fieldType.indexed() && !fieldType.stored()) {
|
||||
context.ignoredValue(names.indexName(), String.valueOf(timestamp));
|
||||
return null;
|
||||
}
|
||||
|
@ -223,17 +223,17 @@ public class TimestampFieldMapper extends DateFieldMapper implements InternalMap
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
// if all are defaults, no sense to write it at all
|
||||
if (indexed() == Defaults.FIELD_TYPE.indexed() &&
|
||||
stored() == Defaults.FIELD_TYPE.stored() && enabled == Defaults.ENABLED && path == Defaults.PATH
|
||||
if (fieldType.indexed() == Defaults.FIELD_TYPE.indexed() &&
|
||||
fieldType.stored() == Defaults.FIELD_TYPE.stored() && enabled == Defaults.ENABLED && path == Defaults.PATH
|
||||
&& dateTimeFormatter.format().equals(Defaults.DATE_TIME_FORMATTER.format())) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (indexed() != Defaults.FIELD_TYPE.indexed()) {
|
||||
builder.field("index", indexed());
|
||||
if (fieldType.indexed() != Defaults.FIELD_TYPE.indexed()) {
|
||||
builder.field("index", fieldType.indexed());
|
||||
}
|
||||
if (stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
}
|
||||
if (enabled != Defaults.ENABLED) {
|
||||
builder.field("enabled", enabled);
|
||||
|
|
|
@ -126,7 +126,7 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
|||
|
||||
@Override
|
||||
public Filter fieldFilter(String value, @Nullable QueryParseContext context) {
|
||||
if (!indexed()) {
|
||||
if (!fieldType.indexed()) {
|
||||
return new PrefixFilter(new Term(UidFieldMapper.NAME, Uid.typePrefix(value)));
|
||||
}
|
||||
return new TermFilter(names().createIndexNameTerm(value));
|
||||
|
@ -167,7 +167,7 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
|||
|
||||
@Override
|
||||
protected Field parseCreateField(ParseContext context) throws IOException {
|
||||
if (!indexed() && !stored()) {
|
||||
if (!fieldType.indexed() && !fieldType.stored()) {
|
||||
return null;
|
||||
}
|
||||
return new Field(names.indexName(), context.type(), fieldType);
|
||||
|
@ -181,15 +181,15 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
|||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
// if all are defaults, no sense to write it at all
|
||||
if (stored() == Defaults.FIELD_TYPE.stored() && indexed() == Defaults.FIELD_TYPE.indexed()) {
|
||||
if (fieldType.stored() == Defaults.FIELD_TYPE.stored() && fieldType.indexed() == Defaults.FIELD_TYPE.indexed()) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", stored());
|
||||
if (fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
}
|
||||
if (indexed() != Defaults.FIELD_TYPE.indexed()) {
|
||||
builder.field("index", indexed());
|
||||
if (fieldType.indexed() != Defaults.FIELD_TYPE.indexed()) {
|
||||
builder.field("index", fieldType.indexed());
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -106,7 +106,7 @@ public class FetchPhase implements SearchPhase {
|
|||
continue;
|
||||
}
|
||||
FieldMappers x = context.smartNameFieldMappers(fieldName);
|
||||
if (x != null && x.mapper().stored()) {
|
||||
if (x != null && x.mapper().fieldType().stored()) {
|
||||
if (fieldNames == null) {
|
||||
fieldNames = new HashSet<String>();
|
||||
}
|
||||
|
|
|
@ -128,9 +128,9 @@ public class HighlightPhase extends AbstractComponent implements FetchSubPhase {
|
|||
if (field.highlighterType() == null) {
|
||||
// if we can do highlighting using Term Vectors, use FastVectorHighlighter, otherwise, use the
|
||||
// slower plain highlighter
|
||||
useFastVectorHighlighter = mapper.storeTermVectors() && mapper.storeTermVectorOffsets() && mapper.storeTermVectorPositions();
|
||||
useFastVectorHighlighter = mapper.fieldType().storeTermVectors() && mapper.fieldType().storeTermVectorOffsets() && mapper.fieldType().storeTermVectorPositions();
|
||||
} else if (field.highlighterType().equals("fast-vector-highlighter") || field.highlighterType().equals("fvh")) {
|
||||
if (!(mapper.storeTermVectors() && mapper.storeTermVectorOffsets() && mapper.storeTermVectorPositions())) {
|
||||
if (!(mapper.fieldType().storeTermVectors() && mapper.fieldType().storeTermVectorOffsets() && mapper.fieldType().storeTermVectorPositions())) {
|
||||
throw new ElasticSearchIllegalArgumentException("the field [" + field.field() + "] should be indexed with term vector with position offsets to be used with fast vector highlighter");
|
||||
}
|
||||
useFastVectorHighlighter = true;
|
||||
|
@ -173,7 +173,7 @@ public class HighlightPhase extends AbstractComponent implements FetchSubPhase {
|
|||
}
|
||||
|
||||
List<Object> textsToHighlight;
|
||||
if (mapper.stored()) {
|
||||
if (mapper.fieldType().stored()) {
|
||||
try {
|
||||
CustomFieldsVisitor fieldVisitor = new CustomFieldsVisitor(ImmutableSet.of(mapper.names().indexName()), false);
|
||||
hitContext.reader().document(hitContext.docId(), fieldVisitor);
|
||||
|
@ -249,7 +249,7 @@ public class HighlightPhase extends AbstractComponent implements FetchSubPhase {
|
|||
if (field.numberOfFragments() == 0) {
|
||||
fragListBuilder = new SingleFragListBuilder();
|
||||
|
||||
if (mapper.stored()) {
|
||||
if (mapper.fieldType().stored()) {
|
||||
fragmentsBuilder = new XSimpleFragmentsBuilder(field.preTags(), field.postTags(), boundaryScanner);
|
||||
} else {
|
||||
fragmentsBuilder = new SourceSimpleFragmentsBuilder(mapper, context, field.preTags(), field.postTags(), boundaryScanner);
|
||||
|
@ -261,13 +261,13 @@ public class HighlightPhase extends AbstractComponent implements FetchSubPhase {
|
|||
fragListBuilder = new SimpleFragListBuilder(field.fragmentOffset());
|
||||
|
||||
if (field.scoreOrdered()) {
|
||||
if (mapper.stored()) {
|
||||
if (mapper.fieldType().stored()) {
|
||||
fragmentsBuilder = new XScoreOrderFragmentsBuilder(field.preTags(), field.postTags(), boundaryScanner);
|
||||
} else {
|
||||
fragmentsBuilder = new SourceScoreOrderFragmentsBuilder(mapper, context, field.preTags(), field.postTags(), boundaryScanner);
|
||||
}
|
||||
} else {
|
||||
if (mapper.stored()) {
|
||||
if (mapper.fieldType().stored()) {
|
||||
fragmentsBuilder = new XSimpleFragmentsBuilder(field.preTags(), field.postTags(), boundaryScanner);
|
||||
} else {
|
||||
fragmentsBuilder = new SourceSimpleFragmentsBuilder(mapper, context, field.preTags(), field.postTags(), boundaryScanner);
|
||||
|
|
|
@ -51,7 +51,7 @@ public class GenericStoreDynamicTemplateTests {
|
|||
|
||||
FieldMappers fieldMappers = docMapper.mappers().fullName("name");
|
||||
assertThat(fieldMappers.mappers().size(), equalTo(1));
|
||||
assertThat(fieldMappers.mapper().stored(), equalTo(true));
|
||||
assertThat(fieldMappers.mapper().fieldType().stored(), equalTo(true));
|
||||
|
||||
f = doc.getField("age");
|
||||
assertThat(f.name(), equalTo("age"));
|
||||
|
@ -59,6 +59,6 @@ public class GenericStoreDynamicTemplateTests {
|
|||
|
||||
fieldMappers = docMapper.mappers().fullName("age");
|
||||
assertThat(fieldMappers.mappers().size(), equalTo(1));
|
||||
assertThat(fieldMappers.mapper().stored(), equalTo(true));
|
||||
assertThat(fieldMappers.mapper().fieldType().stored(), equalTo(true));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class PathMatchDynamicTemplateTests {
|
|||
|
||||
FieldMappers fieldMappers = docMapper.mappers().fullName("name");
|
||||
assertThat(fieldMappers.mappers().size(), equalTo(1));
|
||||
assertThat(fieldMappers.mapper().stored(), equalTo(false));
|
||||
assertThat(fieldMappers.mapper().fieldType().stored(), equalTo(false));
|
||||
|
||||
f = doc.getField("obj1.name");
|
||||
assertThat(f.name(), equalTo("obj1.name"));
|
||||
|
@ -61,7 +61,7 @@ public class PathMatchDynamicTemplateTests {
|
|||
|
||||
fieldMappers = docMapper.mappers().fullName("obj1.name");
|
||||
assertThat(fieldMappers.mappers().size(), equalTo(1));
|
||||
assertThat(fieldMappers.mapper().stored(), equalTo(true));
|
||||
assertThat(fieldMappers.mapper().fieldType().stored(), equalTo(true));
|
||||
|
||||
f = doc.getField("obj1.obj2.name");
|
||||
assertThat(f.name(), equalTo("obj1.obj2.name"));
|
||||
|
@ -69,7 +69,7 @@ public class PathMatchDynamicTemplateTests {
|
|||
|
||||
fieldMappers = docMapper.mappers().fullName("obj1.obj2.name");
|
||||
assertThat(fieldMappers.mappers().size(), equalTo(1));
|
||||
assertThat(fieldMappers.mapper().stored(), equalTo(false));
|
||||
assertThat(fieldMappers.mapper().fieldType().stored(), equalTo(false));
|
||||
|
||||
// verify more complex path_match expressions
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.test.unit.index.mapper.index;
|
||||
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.ParsedDocument;
|
||||
|
@ -43,7 +42,7 @@ public class IndexTypeMapperTests {
|
|||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
IndexFieldMapper indexMapper = docMapper.rootMapper(IndexFieldMapper.class);
|
||||
assertThat(indexMapper.enabled(), equalTo(true));
|
||||
assertThat(indexMapper.stored(), equalTo(true));
|
||||
assertThat(indexMapper.fieldType().stored(), equalTo(true));
|
||||
assertThat(docMapper.mappers().indexName("_index").mapper(), instanceOf(IndexFieldMapper.class));
|
||||
|
||||
ParsedDocument doc = docMapper.parse("type", "1", XContentFactory.jsonBuilder()
|
||||
|
@ -64,7 +63,7 @@ public class IndexTypeMapperTests {
|
|||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
IndexFieldMapper indexMapper = docMapper.rootMapper(IndexFieldMapper.class);
|
||||
assertThat(indexMapper.enabled(), equalTo(false));
|
||||
assertThat(indexMapper.stored(), equalTo(true));
|
||||
assertThat(indexMapper.fieldType().stored(), equalTo(true));
|
||||
|
||||
ParsedDocument doc = docMapper.parse("type", "1", XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
|
@ -83,7 +82,7 @@ public class IndexTypeMapperTests {
|
|||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
IndexFieldMapper indexMapper = docMapper.rootMapper(IndexFieldMapper.class);
|
||||
assertThat(indexMapper.enabled(), equalTo(false));
|
||||
assertThat(indexMapper.stored(), equalTo(false));
|
||||
assertThat(indexMapper.fieldType().stored(), equalTo(false));
|
||||
|
||||
ParsedDocument doc = docMapper.parse("type", "1", XContentFactory.jsonBuilder()
|
||||
.startObject()
|
||||
|
|
|
@ -49,7 +49,7 @@ public class JavaMultiFieldMergeTests {
|
|||
|
||||
DocumentMapper docMapper = parser.parse(mapping);
|
||||
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name.indexed"), nullValue());
|
||||
|
||||
BytesReference json = new BytesArray(copyToBytesFromClasspath("/org/elasticsearch/test/unit/index/mapper/multifield/merge/test-data.json"));
|
||||
|
@ -68,9 +68,9 @@ public class JavaMultiFieldMergeTests {
|
|||
|
||||
docMapper.merge(docMapper2, mergeFlags().simulate(false));
|
||||
|
||||
assertThat(docMapper.mappers().name("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().name("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name.indexed").mapper(), notNullValue());
|
||||
assertThat(docMapper.mappers().fullName("name.not_indexed").mapper(), notNullValue());
|
||||
assertThat(docMapper.mappers().fullName("name.not_indexed2"), nullValue());
|
||||
|
@ -91,9 +91,9 @@ public class JavaMultiFieldMergeTests {
|
|||
|
||||
docMapper.merge(docMapper3, mergeFlags().simulate(false));
|
||||
|
||||
assertThat(docMapper.mappers().name("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().name("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name.indexed").mapper(), notNullValue());
|
||||
assertThat(docMapper.mappers().fullName("name.not_indexed").mapper(), notNullValue());
|
||||
assertThat(docMapper.mappers().fullName("name.not_indexed2").mapper(), notNullValue());
|
||||
|
@ -108,9 +108,9 @@ public class JavaMultiFieldMergeTests {
|
|||
|
||||
docMapper.merge(docMapper4, mergeFlags().simulate(false));
|
||||
|
||||
assertThat(docMapper.mappers().name("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().name("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name").mapper().fieldType().indexed(), equalTo(true));
|
||||
assertThat(docMapper.mappers().fullName("name.indexed").mapper(), notNullValue());
|
||||
assertThat(docMapper.mappers().fullName("name.not_indexed").mapper(), notNullValue());
|
||||
assertThat(docMapper.mappers().fullName("name.not_indexed2").mapper(), notNullValue());
|
||||
|
|
|
@ -73,8 +73,8 @@ public class TimestampMappingTests {
|
|||
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().string();
|
||||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
assertThat(docMapper.timestampFieldMapper().enabled(), equalTo(TimestampFieldMapper.Defaults.ENABLED));
|
||||
assertThat(docMapper.timestampFieldMapper().stored(), equalTo(TimestampFieldMapper.Defaults.FIELD_TYPE.stored()));
|
||||
assertThat(docMapper.timestampFieldMapper().indexed(), equalTo(TimestampFieldMapper.Defaults.FIELD_TYPE.indexed()));
|
||||
assertThat(docMapper.timestampFieldMapper().fieldType().stored(), equalTo(TimestampFieldMapper.Defaults.FIELD_TYPE.stored()));
|
||||
assertThat(docMapper.timestampFieldMapper().fieldType().indexed(), equalTo(TimestampFieldMapper.Defaults.FIELD_TYPE.indexed()));
|
||||
assertThat(docMapper.timestampFieldMapper().path(), equalTo(null));
|
||||
assertThat(docMapper.timestampFieldMapper().dateTimeFormatter().format(), equalTo(TimestampFieldMapper.DEFAULT_DATE_TIME_FORMAT));
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ public class TimestampMappingTests {
|
|||
.endObject().endObject().string();
|
||||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
assertThat(docMapper.timestampFieldMapper().enabled(), equalTo(true));
|
||||
assertThat(docMapper.timestampFieldMapper().stored(), equalTo(true));
|
||||
assertThat(docMapper.timestampFieldMapper().indexed(), equalTo(false));
|
||||
assertThat(docMapper.timestampFieldMapper().fieldType().stored(), equalTo(true));
|
||||
assertThat(docMapper.timestampFieldMapper().fieldType().indexed(), equalTo(false));
|
||||
assertThat(docMapper.timestampFieldMapper().path(), equalTo("timestamp"));
|
||||
assertThat(docMapper.timestampFieldMapper().dateTimeFormatter().format(), equalTo("year"));
|
||||
}
|
||||
|
|
|
@ -71,8 +71,8 @@ public class TTLMappingTests {
|
|||
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type").endObject().string();
|
||||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
assertThat(docMapper.TTLFieldMapper().enabled(), equalTo(TTLFieldMapper.Defaults.ENABLED));
|
||||
assertThat(docMapper.TTLFieldMapper().stored(), equalTo(TTLFieldMapper.Defaults.TTL_FIELD_TYPE.stored()));
|
||||
assertThat(docMapper.TTLFieldMapper().indexed(), equalTo(TTLFieldMapper.Defaults.TTL_FIELD_TYPE.indexed()));
|
||||
assertThat(docMapper.TTLFieldMapper().fieldType().stored(), equalTo(TTLFieldMapper.Defaults.TTL_FIELD_TYPE.stored()));
|
||||
assertThat(docMapper.TTLFieldMapper().fieldType().indexed(), equalTo(TTLFieldMapper.Defaults.TTL_FIELD_TYPE.indexed()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class TTLMappingTests {
|
|||
.endObject().endObject().string();
|
||||
DocumentMapper docMapper = MapperTests.newParser().parse(mapping);
|
||||
assertThat(docMapper.TTLFieldMapper().enabled(), equalTo(true));
|
||||
assertThat(docMapper.TTLFieldMapper().stored(), equalTo(false));
|
||||
assertThat(docMapper.TTLFieldMapper().indexed(), equalTo(false));
|
||||
assertThat(docMapper.TTLFieldMapper().fieldType().stored(), equalTo(false));
|
||||
assertThat(docMapper.TTLFieldMapper().fieldType().indexed(), equalTo(false));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue