Mappings: Replace fieldType access in mappers with getter
A small refactoring to allow changing how the field type is stored later.
This commit is contained in:
parent
8c21a84b09
commit
f09e0d7fb4
|
@ -304,12 +304,12 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
|
||||
this.fieldType = fieldType.clone();
|
||||
if (fieldType.indexAnalyzer() == null && fieldType.tokenized() == false && fieldType.indexOptions() != IndexOptions.NONE) {
|
||||
this.fieldType.setIndexAnalyzer(Lucene.KEYWORD_ANALYZER);
|
||||
this.fieldType.setSearchAnalyzer(Lucene.KEYWORD_ANALYZER);
|
||||
this.fieldType().setIndexAnalyzer(Lucene.KEYWORD_ANALYZER);
|
||||
this.fieldType().setSearchAnalyzer(Lucene.KEYWORD_ANALYZER);
|
||||
}
|
||||
this.fieldType.setHasDocValues(docValues == null ? defaultDocValues() : docValues);
|
||||
this.fieldType.setFieldDataType(fieldDataType);
|
||||
this.fieldType.freeze();
|
||||
this.fieldType().setHasDocValues(docValues == null ? defaultDocValues() : docValues);
|
||||
this.fieldType().setFieldDataType(fieldDataType);
|
||||
this.fieldType().freeze();
|
||||
|
||||
this.multiFields = multiFields;
|
||||
this.copyTo = copyTo;
|
||||
|
@ -319,14 +319,14 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
if (indexCreatedBefore2x) {
|
||||
return false;
|
||||
} else {
|
||||
return fieldType.tokenized() == false && fieldType.indexOptions() != IndexOptions.NONE;
|
||||
return fieldType().tokenized() == false && fieldType().indexOptions() != IndexOptions.NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
// TODO: cleanup names so Mapper knows about paths, so that it is always clear whether we are using short or full name
|
||||
return fieldType.names().shortName();
|
||||
return fieldType().names().shortName();
|
||||
}
|
||||
|
||||
public abstract MappedFieldType defaultFieldType();
|
||||
|
@ -350,12 +350,12 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
parseCreateField(context, fields);
|
||||
for (Field field : fields) {
|
||||
if (!customBoost()) {
|
||||
field.setBoost(fieldType.boost());
|
||||
field.setBoost(fieldType().boost());
|
||||
}
|
||||
context.doc().add(field);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new MapperParsingException("failed to parse [" + fieldType.names().fullName() + "]", e);
|
||||
throw new MapperParsingException("failed to parse [" + fieldType().names().fullName() + "]", e);
|
||||
}
|
||||
multiFields.parse(this, context);
|
||||
return null;
|
||||
|
@ -387,94 +387,94 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
if (mergeWith instanceof AbstractFieldMapper) {
|
||||
mergedType = ((AbstractFieldMapper) mergeWith).contentType();
|
||||
}
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] of different type, current_type [" + contentType() + "], merged_type [" + mergedType + "]");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] of different type, current_type [" + contentType() + "], merged_type [" + mergedType + "]");
|
||||
// different types, return
|
||||
return;
|
||||
}
|
||||
AbstractFieldMapper fieldMergeWith = (AbstractFieldMapper) mergeWith;
|
||||
boolean indexed = fieldType.indexOptions() != IndexOptions.NONE;
|
||||
boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
|
||||
boolean mergeWithIndexed = fieldMergeWith.fieldType().indexOptions() != IndexOptions.NONE;
|
||||
if (indexed != mergeWithIndexed || this.fieldType().tokenized() != fieldMergeWith.fieldType().tokenized()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different index values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different index values");
|
||||
}
|
||||
if (this.fieldType().stored() != fieldMergeWith.fieldType().stored()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different store values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different store values");
|
||||
}
|
||||
if (!this.fieldType().hasDocValues() && fieldMergeWith.fieldType().hasDocValues()) {
|
||||
// don't add conflict if this mapper has doc values while the mapper to merge doesn't since doc values are implicitely set
|
||||
// when the doc_values field data format is configured
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different " + TypeParsers.DOC_VALUES + " values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different " + TypeParsers.DOC_VALUES + " values");
|
||||
}
|
||||
if (this.fieldType().omitNorms() && !fieldMergeWith.fieldType.omitNorms()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] cannot enable norms (`norms.enabled`)");
|
||||
if (this.fieldType().omitNorms() && !fieldMergeWith.fieldType().omitNorms()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] cannot enable norms (`norms.enabled`)");
|
||||
}
|
||||
if (this.fieldType().tokenized() != fieldMergeWith.fieldType().tokenized()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different tokenize values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different tokenize values");
|
||||
}
|
||||
if (this.fieldType().storeTermVectors() != fieldMergeWith.fieldType().storeTermVectors()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different store_term_vector values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different store_term_vector values");
|
||||
}
|
||||
if (this.fieldType().storeTermVectorOffsets() != fieldMergeWith.fieldType().storeTermVectorOffsets()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different store_term_vector_offsets values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different store_term_vector_offsets values");
|
||||
}
|
||||
if (this.fieldType().storeTermVectorPositions() != fieldMergeWith.fieldType().storeTermVectorPositions()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different store_term_vector_positions values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different store_term_vector_positions values");
|
||||
}
|
||||
if (this.fieldType().storeTermVectorPayloads() != fieldMergeWith.fieldType().storeTermVectorPayloads()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different store_term_vector_payloads values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different store_term_vector_payloads values");
|
||||
}
|
||||
|
||||
// null and "default"-named index analyzers both mean the default is used
|
||||
if (this.fieldType.indexAnalyzer() == null || "default".equals(this.fieldType.indexAnalyzer().name())) {
|
||||
if (fieldMergeWith.fieldType.indexAnalyzer() != null && "default".equals(fieldMergeWith.fieldType.indexAnalyzer().name()) == false) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different analyzer");
|
||||
if (this.fieldType().indexAnalyzer() == null || "default".equals(this.fieldType().indexAnalyzer().name())) {
|
||||
if (fieldMergeWith.fieldType().indexAnalyzer() != null && "default".equals(fieldMergeWith.fieldType().indexAnalyzer().name()) == false) {
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different analyzer");
|
||||
}
|
||||
} else if (fieldMergeWith.fieldType.indexAnalyzer() == null || "default".equals(fieldMergeWith.fieldType.indexAnalyzer().name())) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different analyzer");
|
||||
} else if (this.fieldType.indexAnalyzer().name().equals(fieldMergeWith.fieldType.indexAnalyzer().name()) == false) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different analyzer");
|
||||
} else if (fieldMergeWith.fieldType().indexAnalyzer() == null || "default".equals(fieldMergeWith.fieldType().indexAnalyzer().name())) {
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different analyzer");
|
||||
} else if (this.fieldType().indexAnalyzer().name().equals(fieldMergeWith.fieldType().indexAnalyzer().name()) == false) {
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different analyzer");
|
||||
}
|
||||
|
||||
if (!this.fieldType().names().equals(fieldMergeWith.fieldType().names())) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different index_name");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different index_name");
|
||||
}
|
||||
|
||||
if (this.fieldType.similarity() == null) {
|
||||
if (fieldMergeWith.fieldType.similarity() != null) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different similarity");
|
||||
if (this.fieldType().similarity() == null) {
|
||||
if (fieldMergeWith.fieldType().similarity() != null) {
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different similarity");
|
||||
}
|
||||
} else if (fieldMergeWith.fieldType().similarity() == null) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different similarity");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different similarity");
|
||||
} else if (!this.fieldType().similarity().equals(fieldMergeWith.fieldType().similarity())) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different similarity");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different similarity");
|
||||
}
|
||||
multiFields.merge(mergeWith, mergeResult);
|
||||
|
||||
if (!mergeResult.simulate()) {
|
||||
// apply changeable values
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType.setOmitNorms(fieldMergeWith.fieldType.omitNorms());
|
||||
this.fieldType.setBoost(fieldMergeWith.fieldType.boost());
|
||||
this.fieldType.setNormsLoading(fieldMergeWith.fieldType.normsLoading());
|
||||
if (fieldMergeWith.fieldType.searchAnalyzer() != null) {
|
||||
this.fieldType.setSearchAnalyzer(fieldMergeWith.fieldType.searchAnalyzer());
|
||||
this.fieldType = this.fieldType().clone();
|
||||
this.fieldType().setOmitNorms(fieldMergeWith.fieldType().omitNorms());
|
||||
this.fieldType().setBoost(fieldMergeWith.fieldType().boost());
|
||||
this.fieldType().setNormsLoading(fieldMergeWith.fieldType().normsLoading());
|
||||
if (fieldMergeWith.fieldType().searchAnalyzer() != null) {
|
||||
this.fieldType().setSearchAnalyzer(fieldMergeWith.fieldType().searchAnalyzer());
|
||||
}
|
||||
if (fieldMergeWith.customFieldDataSettings != null) {
|
||||
if (!Objects.equal(fieldMergeWith.customFieldDataSettings, this.customFieldDataSettings)) {
|
||||
this.customFieldDataSettings = fieldMergeWith.customFieldDataSettings;
|
||||
this.fieldType.setFieldDataType(new FieldDataType(defaultFieldDataType().getType(),
|
||||
this.fieldType().setFieldDataType(new FieldDataType(defaultFieldDataType().getType(),
|
||||
Settings.builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings)
|
||||
));
|
||||
}
|
||||
}
|
||||
this.fieldType.freeze();
|
||||
this.fieldType().freeze();
|
||||
this.copyTo = fieldMergeWith.copyTo;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject(fieldType.names().shortName());
|
||||
builder.startObject(fieldType().names().shortName());
|
||||
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
||||
doXContentBody(builder, includeDefaults, params);
|
||||
return builder.endObject();
|
||||
|
@ -483,40 +483,40 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
|
||||
|
||||
builder.field("type", contentType());
|
||||
if (indexCreatedBefore2x && (includeDefaults || !fieldType.names().shortName().equals(fieldType.names().originalIndexName()))) {
|
||||
builder.field("index_name", fieldType.names().originalIndexName());
|
||||
if (indexCreatedBefore2x && (includeDefaults || !fieldType().names().shortName().equals(fieldType().names().originalIndexName()))) {
|
||||
builder.field("index_name", fieldType().names().originalIndexName());
|
||||
}
|
||||
|
||||
if (includeDefaults || fieldType.boost() != 1.0f) {
|
||||
builder.field("boost", fieldType.boost());
|
||||
if (includeDefaults || fieldType().boost() != 1.0f) {
|
||||
builder.field("boost", fieldType().boost());
|
||||
}
|
||||
|
||||
FieldType defaultFieldType = defaultFieldType();
|
||||
boolean indexed = fieldType.indexOptions() != IndexOptions.NONE;
|
||||
boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
|
||||
boolean defaultIndexed = defaultFieldType.indexOptions() != IndexOptions.NONE;
|
||||
if (includeDefaults || indexed != defaultIndexed ||
|
||||
fieldType.tokenized() != defaultFieldType.tokenized()) {
|
||||
builder.field("index", indexTokenizeOptionToString(indexed, fieldType.tokenized()));
|
||||
fieldType().tokenized() != defaultFieldType.tokenized()) {
|
||||
builder.field("index", indexTokenizeOptionToString(indexed, fieldType().tokenized()));
|
||||
}
|
||||
if (includeDefaults || fieldType.stored() != defaultFieldType.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
if (includeDefaults || fieldType().stored() != defaultFieldType.stored()) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
doXContentDocValues(builder, includeDefaults);
|
||||
if (includeDefaults || fieldType.storeTermVectors() != defaultFieldType.storeTermVectors()) {
|
||||
builder.field("term_vector", termVectorOptionsToString(fieldType));
|
||||
if (includeDefaults || fieldType().storeTermVectors() != defaultFieldType.storeTermVectors()) {
|
||||
builder.field("term_vector", termVectorOptionsToString(fieldType()));
|
||||
}
|
||||
if (includeDefaults || fieldType.omitNorms() != defaultFieldType.omitNorms() || fieldType.normsLoading() != null) {
|
||||
if (includeDefaults || fieldType().omitNorms() != defaultFieldType.omitNorms() || fieldType().normsLoading() != null) {
|
||||
builder.startObject("norms");
|
||||
if (includeDefaults || fieldType.omitNorms() != defaultFieldType.omitNorms()) {
|
||||
builder.field("enabled", !fieldType.omitNorms());
|
||||
if (includeDefaults || fieldType().omitNorms() != defaultFieldType.omitNorms()) {
|
||||
builder.field("enabled", !fieldType().omitNorms());
|
||||
}
|
||||
if (fieldType.normsLoading() != null) {
|
||||
builder.field(MappedFieldType.Loading.KEY, fieldType.normsLoading());
|
||||
if (fieldType().normsLoading() != null) {
|
||||
builder.field(MappedFieldType.Loading.KEY, fieldType().normsLoading());
|
||||
}
|
||||
builder.endObject();
|
||||
}
|
||||
if (indexed && (includeDefaults || fieldType.indexOptions() != defaultFieldType.indexOptions())) {
|
||||
builder.field("index_options", indexOptionToString(fieldType.indexOptions()));
|
||||
if (indexed && (includeDefaults || fieldType().indexOptions() != defaultFieldType.indexOptions())) {
|
||||
builder.field("index_options", indexOptionToString(fieldType().indexOptions()));
|
||||
}
|
||||
|
||||
doXContentAnalyzers(builder, includeDefaults);
|
||||
|
@ -532,7 +532,7 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
orderedFielddataSettings.putAll(customFieldDataSettings.getAsMap());
|
||||
builder.field("fielddata", orderedFielddataSettings);
|
||||
} else if (includeDefaults) {
|
||||
orderedFielddataSettings.putAll(fieldType.fieldDataType().getSettings().getAsMap());
|
||||
orderedFielddataSettings.putAll(fieldType().fieldDataType().getSettings().getAsMap());
|
||||
builder.field("fielddata", orderedFielddataSettings);
|
||||
}
|
||||
multiFields.toXContent(builder, params);
|
||||
|
@ -543,14 +543,14 @@ public abstract class AbstractFieldMapper implements FieldMapper {
|
|||
}
|
||||
|
||||
protected void doXContentAnalyzers(XContentBuilder builder, boolean includeDefaults) throws IOException {
|
||||
if (fieldType.indexAnalyzer() == null) {
|
||||
if (fieldType().indexAnalyzer() == null) {
|
||||
if (includeDefaults) {
|
||||
builder.field("analyzer", "default");
|
||||
}
|
||||
} else if (includeDefaults || fieldType.indexAnalyzer().name().startsWith("_") == false && fieldType.indexAnalyzer().name().equals("default") == false) {
|
||||
builder.field("analyzer", fieldType.indexAnalyzer().name());
|
||||
if (fieldType.searchAnalyzer().name().equals(fieldType.indexAnalyzer().name()) == false) {
|
||||
builder.field("search_analyzer", fieldType.searchAnalyzer().name());
|
||||
} else if (includeDefaults || fieldType().indexAnalyzer().name().startsWith("_") == false && fieldType().indexAnalyzer().name().equals("default") == false) {
|
||||
builder.field("analyzer", fieldType().indexAnalyzer().name());
|
||||
if (fieldType().searchAnalyzer().name().equals(fieldType().indexAnalyzer().name()) == false) {
|
||||
builder.field("search_analyzer", fieldType().searchAnalyzer().name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ public class BooleanFieldMapper extends AbstractFieldMapper {
|
|||
|
||||
@Override
|
||||
public BooleanFieldType fieldType() {
|
||||
return (BooleanFieldType)fieldType;
|
||||
return (BooleanFieldType) super.fieldType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -233,9 +233,9 @@ public class BooleanFieldMapper extends AbstractFieldMapper {
|
|||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
fields.add(new Field(fieldType.names().indexName(), value ? "T" : "F", fieldType));
|
||||
fields.add(new Field(fieldType().names().indexName(), value ? "T" : "F", fieldType()));
|
||||
if (fieldType().hasDocValues()) {
|
||||
fields.add(new SortedNumericDocValuesField(fieldType.names().indexName(), value ? 1 : 0));
|
||||
fields.add(new SortedNumericDocValuesField(fieldType().names().indexName(), value ? 1 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,9 +247,9 @@ public class BooleanFieldMapper extends AbstractFieldMapper {
|
|||
}
|
||||
|
||||
if (!mergeResult.simulate()) {
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType.setNullValue(((BooleanFieldMapper) mergeWith).fieldType().nullValue());
|
||||
this.fieldType.freeze();
|
||||
this.fieldType = fieldType().clone();
|
||||
fieldType().setNullValue(((BooleanFieldMapper) mergeWith).fieldType().nullValue());
|
||||
fieldType().freeze();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.apache.lucene.analysis.TokenStream;
|
|||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -297,7 +297,7 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
|||
|
||||
@Override
|
||||
public CompletionFieldType fieldType() {
|
||||
return (CompletionFieldType)fieldType;
|
||||
return (CompletionFieldType) super.fieldType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -448,7 +448,7 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
|||
+ "] at position " + i + " is a reserved character");
|
||||
}
|
||||
}
|
||||
return new SuggestField(fieldType.names().indexName(), ctx, input, this.fieldType, payload, fieldType().analyzingSuggestLookupProvider);
|
||||
return new SuggestField(fieldType().names().indexName(), ctx, input, fieldType(), payload, fieldType().analyzingSuggestLookupProvider);
|
||||
}
|
||||
|
||||
public static int correctSubStringLen(String input, int len) {
|
||||
|
@ -487,9 +487,9 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
|||
builder.startObject(fieldType().names().shortName())
|
||||
.field(Fields.TYPE, CONTENT_TYPE);
|
||||
|
||||
builder.field(Fields.ANALYZER, fieldType.indexAnalyzer().name());
|
||||
if (fieldType.indexAnalyzer().name().equals(fieldType.searchAnalyzer().name()) == false) {
|
||||
builder.field(Fields.SEARCH_ANALYZER.getPreferredName(), fieldType.searchAnalyzer().name());
|
||||
builder.field(Fields.ANALYZER, fieldType().indexAnalyzer().name());
|
||||
if (fieldType().indexAnalyzer().name().equals(fieldType().searchAnalyzer().name()) == false) {
|
||||
builder.field(Fields.SEARCH_ANALYZER.getPreferredName(), fieldType().searchAnalyzer().name());
|
||||
}
|
||||
builder.field(Fields.PAYLOADS, fieldType().analyzingSuggestLookupProvider.hasPayloads());
|
||||
builder.field(Fields.PRESERVE_SEPARATORS.getPreferredName(), fieldType().analyzingSuggestLookupProvider.getPreserveSep());
|
||||
|
@ -536,16 +536,16 @@ public class CompletionFieldMapper extends AbstractFieldMapper {
|
|||
super.merge(mergeWith, mergeResult);
|
||||
CompletionFieldMapper fieldMergeWith = (CompletionFieldMapper) mergeWith;
|
||||
if (fieldType().analyzingSuggestLookupProvider.hasPayloads() != fieldMergeWith.fieldType().analyzingSuggestLookupProvider.hasPayloads()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different payload values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different payload values");
|
||||
}
|
||||
if (fieldType().analyzingSuggestLookupProvider.getPreservePositionsIncrements() != fieldMergeWith.fieldType().analyzingSuggestLookupProvider.getPreservePositionsIncrements()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different 'preserve_position_increments' values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different 'preserve_position_increments' values");
|
||||
}
|
||||
if (fieldType().analyzingSuggestLookupProvider.getPreserveSep() != fieldMergeWith.fieldType().analyzingSuggestLookupProvider.getPreserveSep()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different 'preserve_separators' values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different 'preserve_separators' values");
|
||||
}
|
||||
if(!ContextMapping.mappingsAreEqual(fieldType().getContextMapping(), fieldMergeWith.fieldType().getContextMapping())) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different 'context_mapping' values");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different 'context_mapping' values");
|
||||
}
|
||||
if (!mergeResult.simulate()) {
|
||||
this.maxInputLength = fieldMergeWith.maxInputLength;
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.apache.lucene.document.Field;
|
|||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -23,10 +23,8 @@ import com.carrotsearch.hppc.FloatArrayList;
|
|||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.DocValuesType;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.lucene.analysis.TokenStream;
|
|||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.lucene.analysis.TokenStream;
|
|||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -188,7 +188,7 @@ public abstract class NumberFieldMapper extends AbstractFieldMapper implements A
|
|||
private ThreadLocal<NumericTokenStream> tokenStream = new ThreadLocal<NumericTokenStream>() {
|
||||
@Override
|
||||
protected NumericTokenStream initialValue() {
|
||||
return new NumericTokenStream(fieldType.numericPrecisionStep());
|
||||
return new NumericTokenStream(fieldType().numericPrecisionStep());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -319,9 +319,9 @@ public abstract class NumberFieldMapper extends AbstractFieldMapper implements A
|
|||
}
|
||||
if (!mergeResult.simulate()) {
|
||||
NumberFieldMapper nfmMergeWith = (NumberFieldMapper) mergeWith;
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType.setNumericPrecisionStep(nfmMergeWith.fieldType.numericPrecisionStep());
|
||||
this.fieldType.freeze();
|
||||
this.fieldType = this.fieldType().clone();
|
||||
this.fieldType().setNumericPrecisionStep(nfmMergeWith.fieldType().numericPrecisionStep());
|
||||
this.fieldType().freeze();
|
||||
this.includeInAll = nfmMergeWith.includeInAll;
|
||||
if (nfmMergeWith.ignoreMalformed.explicit()) {
|
||||
this.ignoreMalformed = nfmMergeWith.ignoreMalformed;
|
||||
|
@ -337,13 +337,13 @@ public abstract class NumberFieldMapper extends AbstractFieldMapper implements A
|
|||
}
|
||||
|
||||
protected NumericTokenStream popCachedStream() {
|
||||
if (fieldType.numericPrecisionStep() == 4) {
|
||||
if (fieldType().numericPrecisionStep() == 4) {
|
||||
return tokenStream4.get();
|
||||
} else if (fieldType.numericPrecisionStep() == 8) {
|
||||
} else if (fieldType().numericPrecisionStep() == 8) {
|
||||
return tokenStream8.get();
|
||||
} else if (fieldType.numericPrecisionStep() == 16) {
|
||||
} else if (fieldType().numericPrecisionStep() == 16) {
|
||||
return tokenStream16.get();
|
||||
} else if (fieldType.numericPrecisionStep() == Integer.MAX_VALUE) {
|
||||
} else if (fieldType().numericPrecisionStep() == Integer.MAX_VALUE) {
|
||||
return tokenStreamMax.get();
|
||||
}
|
||||
return tokenStream.get();
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.lucene.analysis.TokenStream;
|
|||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
|
|
@ -276,7 +276,7 @@ public class StringFieldMapper extends AbstractFieldMapper implements AllFieldMa
|
|||
|
||||
@Override
|
||||
protected void parseCreateField(ParseContext context, List<Field> fields) throws IOException {
|
||||
ValueAndBoost valueAndBoost = parseCreateFieldForString(context, fieldType().nullValueAsString(), fieldType.boost());
|
||||
ValueAndBoost valueAndBoost = parseCreateFieldForString(context, fieldType().nullValueAsString(), fieldType().boost());
|
||||
if (valueAndBoost.value() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -284,19 +284,19 @@ public class StringFieldMapper extends AbstractFieldMapper implements AllFieldMa
|
|||
return;
|
||||
}
|
||||
if (context.includeInAll(includeInAll, this)) {
|
||||
context.allEntries().addText(fieldType.names().fullName(), valueAndBoost.value(), valueAndBoost.boost());
|
||||
context.allEntries().addText(fieldType().names().fullName(), valueAndBoost.value(), valueAndBoost.boost());
|
||||
}
|
||||
|
||||
if (fieldType.indexOptions() != IndexOptions.NONE || fieldType.stored()) {
|
||||
Field field = new Field(fieldType.names().indexName(), valueAndBoost.value(), fieldType);
|
||||
if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
|
||||
Field field = new Field(fieldType().names().indexName(), valueAndBoost.value(), fieldType());
|
||||
field.setBoost(valueAndBoost.boost());
|
||||
fields.add(field);
|
||||
}
|
||||
if (fieldType().hasDocValues()) {
|
||||
fields.add(new SortedSetDocValuesField(fieldType.names().indexName(), new BytesRef(valueAndBoost.value())));
|
||||
fields.add(new SortedSetDocValuesField(fieldType().names().indexName(), new BytesRef(valueAndBoost.value())));
|
||||
}
|
||||
if (fields.isEmpty()) {
|
||||
context.ignoredValue(fieldType.names().indexName(), valueAndBoost.value());
|
||||
context.ignoredValue(fieldType().names().indexName(), valueAndBoost.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,9 +353,9 @@ public class StringFieldMapper extends AbstractFieldMapper implements AllFieldMa
|
|||
if (!mergeResult.simulate()) {
|
||||
this.includeInAll = ((StringFieldMapper) mergeWith).includeInAll;
|
||||
this.ignoreAbove = ((StringFieldMapper) mergeWith).ignoreAbove;
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType.setNullValue(((StringFieldMapper) mergeWith).fieldType().nullValue());
|
||||
this.fieldType.freeze();
|
||||
this.fieldType = this.fieldType().clone();
|
||||
this.fieldType().setNullValue(((StringFieldMapper) mergeWith).fieldType().nullValue());
|
||||
this.fieldType().freeze();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,8 +375,8 @@ public class StringFieldMapper extends AbstractFieldMapper implements AllFieldMa
|
|||
if (includeDefaults || positionOffsetGap != Defaults.POSITION_OFFSET_GAP) {
|
||||
builder.field("position_offset_gap", positionOffsetGap);
|
||||
}
|
||||
NamedAnalyzer searchQuoteAnalyzer = fieldType.searchQuoteAnalyzer();
|
||||
if (searchQuoteAnalyzer != null && !searchQuoteAnalyzer.name().equals(fieldType.searchAnalyzer().name())) {
|
||||
NamedAnalyzer searchQuoteAnalyzer = fieldType().searchQuoteAnalyzer();
|
||||
if (searchQuoteAnalyzer != null && !searchQuoteAnalyzer.name().equals(fieldType().searchAnalyzer().name())) {
|
||||
builder.field("search_quote_analyzer", searchQuoteAnalyzer.name());
|
||||
} else if (includeDefaults) {
|
||||
if (searchQuoteAnalyzer == null) {
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.index.mapper.MergeMappingException;
|
|||
import org.elasticsearch.index.mapper.MergeResult;
|
||||
import org.elasticsearch.index.mapper.ParseContext;
|
||||
import org.elasticsearch.index.mapper.core.StringFieldMapper.ValueAndBoost;
|
||||
import org.elasticsearch.index.similarity.SimilarityProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.index.mapper.geo;
|
|||
|
||||
import com.carrotsearch.hppc.ObjectHashSet;
|
||||
import com.carrotsearch.hppc.cursors.ObjectCursor;
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Iterators;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
|
@ -568,7 +567,7 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
|||
|
||||
@Override
|
||||
public GeoPointFieldType fieldType() {
|
||||
return (GeoPointFieldType)fieldType;
|
||||
return (GeoPointFieldType) super.fieldType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -679,8 +678,8 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
|||
}
|
||||
}
|
||||
|
||||
if (fieldType.indexOptions() != IndexOptions.NONE || fieldType.stored()) {
|
||||
Field field = new Field(fieldType.names().indexName(), Double.toString(point.lat()) + ',' + Double.toString(point.lon()), fieldType);
|
||||
if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
|
||||
Field field = new Field(fieldType().names().indexName(), Double.toString(point.lat()) + ',' + Double.toString(point.lon()), fieldType());
|
||||
context.doc().add(field);
|
||||
}
|
||||
if (fieldType().isGeohashEnabled()) {
|
||||
|
@ -728,32 +727,32 @@ public class GeoPointFieldMapper extends AbstractFieldMapper implements ArrayVal
|
|||
GeoPointFieldMapper fieldMergeWith = (GeoPointFieldMapper) mergeWith;
|
||||
|
||||
if (this.fieldType().isLatLonEnabled() != fieldMergeWith.fieldType().isLatLonEnabled()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different lat_lon");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different lat_lon");
|
||||
}
|
||||
if (this.fieldType().isGeohashEnabled() != fieldMergeWith.fieldType().isGeohashEnabled()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different geohash");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different geohash");
|
||||
}
|
||||
if (this.fieldType().geohashPrecision() != fieldMergeWith.fieldType().geohashPrecision()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different geohash_precision");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different geohash_precision");
|
||||
}
|
||||
if (this.fieldType().isGeohashPrefixEnabled() != fieldMergeWith.fieldType().isGeohashPrefixEnabled()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different geohash_prefix");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different geohash_prefix");
|
||||
}
|
||||
if (this.fieldType().normalizeLat() != fieldMergeWith.fieldType().normalizeLat()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different normalize_lat");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different normalize_lat");
|
||||
}
|
||||
if (this.fieldType().normalizeLon() != fieldMergeWith.fieldType().normalizeLon()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different normalize_lon");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different normalize_lon");
|
||||
}
|
||||
if (fieldType().isLatLonEnabled() &&
|
||||
this.fieldType().latFieldType().numericPrecisionStep() != fieldMergeWith.fieldType().latFieldType().numericPrecisionStep()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different precision_step");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different precision_step");
|
||||
}
|
||||
if (this.fieldType().validateLat() != fieldMergeWith.fieldType().validateLat()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different validate_lat");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different validate_lat");
|
||||
}
|
||||
if (this.fieldType().validateLon() != fieldMergeWith.fieldType().validateLon()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different validate_lon");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different validate_lon");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||
import org.elasticsearch.index.mapper.Mapper;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
|
@ -340,7 +339,7 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
|||
|
||||
@Override
|
||||
public GeoShapeFieldType fieldType() {
|
||||
return (GeoShapeFieldType)fieldType;
|
||||
return (GeoShapeFieldType) super.fieldType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -370,12 +369,12 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
|||
}
|
||||
for (Field field : fields) {
|
||||
if (!customBoost()) {
|
||||
field.setBoost(fieldType.boost());
|
||||
field.setBoost(fieldType().boost());
|
||||
}
|
||||
context.doc().add(field);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new MapperParsingException("failed to parse [" + fieldType.names().fullName() + "]", e);
|
||||
throw new MapperParsingException("failed to parse [" + fieldType().names().fullName() + "]", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -384,28 +383,28 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
|||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
||||
super.merge(mergeWith, mergeResult);
|
||||
if (!this.getClass().equals(mergeWith.getClass())) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different field type");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different field type");
|
||||
return;
|
||||
}
|
||||
final GeoShapeFieldMapper fieldMergeWith = (GeoShapeFieldMapper) mergeWith;
|
||||
|
||||
// prevent user from changing strategies
|
||||
if (fieldType().strategyName().equals(fieldMergeWith.fieldType().strategyName()) == false) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different strategy");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different strategy");
|
||||
}
|
||||
|
||||
// prevent user from changing trees (changes encoding)
|
||||
if (fieldType().tree().equals(fieldMergeWith.fieldType().tree()) == false) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different tree");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different tree");
|
||||
}
|
||||
|
||||
// TODO we should allow this, but at the moment levels is used to build bookkeeping variables
|
||||
// in lucene's SpatialPrefixTree implementations, need a patch to correct that first
|
||||
if (fieldType().treeLevels() != fieldMergeWith.fieldType().treeLevels()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different tree_levels");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different tree_levels");
|
||||
}
|
||||
if (fieldType().precisionInMeters() != fieldMergeWith.fieldType().precisionInMeters()) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] has different precision");
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] has different precision");
|
||||
}
|
||||
|
||||
// bail if there were merge conflicts
|
||||
|
@ -414,12 +413,12 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper {
|
|||
}
|
||||
|
||||
// change distance error percent
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType = fieldType().clone();
|
||||
this.fieldType().setDistanceErrorPct(fieldMergeWith.fieldType().distanceErrorPct());
|
||||
// change orientation - this is allowed because existing dateline spanning shapes
|
||||
// have already been unwound and segmented
|
||||
this.fieldType().setOrientation(fieldMergeWith.fieldType().orientation());
|
||||
this.fieldType.freeze();
|
||||
fieldType().freeze();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -239,11 +239,11 @@ public class AllFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
// reset the entries
|
||||
context.allEntries().reset();
|
||||
Analyzer analyzer = findAnalyzer(context);
|
||||
fields.add(new AllField(fieldType.names().indexName(), context.allEntries(), analyzer, fieldType));
|
||||
fields.add(new AllField(fieldType().names().indexName(), context.allEntries(), analyzer, fieldType()));
|
||||
}
|
||||
|
||||
private Analyzer findAnalyzer(ParseContext context) {
|
||||
Analyzer analyzer = fieldType.indexAnalyzer();
|
||||
Analyzer analyzer = fieldType().indexAnalyzer();
|
||||
if (analyzer == null) {
|
||||
analyzer = context.docMapper().mappers().indexAnalyzer();
|
||||
if (analyzer == null) {
|
||||
|
@ -285,23 +285,23 @@ public class AllFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
if (includeDefaults || enabledState != Defaults.ENABLED) {
|
||||
builder.field("enabled", enabledState.enabled);
|
||||
}
|
||||
if (includeDefaults || fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
if (includeDefaults || fieldType().stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
if (includeDefaults || fieldType.storeTermVectors() != Defaults.FIELD_TYPE.storeTermVectors()) {
|
||||
builder.field("store_term_vectors", fieldType.storeTermVectors());
|
||||
if (includeDefaults || fieldType().storeTermVectors() != Defaults.FIELD_TYPE.storeTermVectors()) {
|
||||
builder.field("store_term_vectors", fieldType().storeTermVectors());
|
||||
}
|
||||
if (includeDefaults || fieldType.storeTermVectorOffsets() != Defaults.FIELD_TYPE.storeTermVectorOffsets()) {
|
||||
builder.field("store_term_vector_offsets", fieldType.storeTermVectorOffsets());
|
||||
if (includeDefaults || fieldType().storeTermVectorOffsets() != Defaults.FIELD_TYPE.storeTermVectorOffsets()) {
|
||||
builder.field("store_term_vector_offsets", fieldType().storeTermVectorOffsets());
|
||||
}
|
||||
if (includeDefaults || fieldType.storeTermVectorPositions() != Defaults.FIELD_TYPE.storeTermVectorPositions()) {
|
||||
builder.field("store_term_vector_positions", fieldType.storeTermVectorPositions());
|
||||
if (includeDefaults || fieldType().storeTermVectorPositions() != Defaults.FIELD_TYPE.storeTermVectorPositions()) {
|
||||
builder.field("store_term_vector_positions", fieldType().storeTermVectorPositions());
|
||||
}
|
||||
if (includeDefaults || fieldType.storeTermVectorPayloads() != Defaults.FIELD_TYPE.storeTermVectorPayloads()) {
|
||||
builder.field("store_term_vector_payloads", fieldType.storeTermVectorPayloads());
|
||||
if (includeDefaults || fieldType().storeTermVectorPayloads() != Defaults.FIELD_TYPE.storeTermVectorPayloads()) {
|
||||
builder.field("store_term_vector_payloads", fieldType().storeTermVectorPayloads());
|
||||
}
|
||||
if (includeDefaults || fieldType.omitNorms() != Defaults.FIELD_TYPE.omitNorms()) {
|
||||
builder.field("omit_norms", fieldType.omitNorms());
|
||||
if (includeDefaults || fieldType().omitNorms() != Defaults.FIELD_TYPE.omitNorms()) {
|
||||
builder.field("omit_norms", fieldType().omitNorms());
|
||||
}
|
||||
|
||||
doXContentAnalyzers(builder, includeDefaults);
|
||||
|
@ -315,14 +315,14 @@ public class AllFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
if (customFieldDataSettings != null) {
|
||||
builder.field("fielddata", (Map) customFieldDataSettings.getAsMap());
|
||||
} else if (includeDefaults) {
|
||||
builder.field("fielddata", (Map) fieldType.fieldDataType().getSettings().getAsMap());
|
||||
builder.field("fielddata", (Map) fieldType().fieldDataType().getSettings().getAsMap());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void merge(Mapper mergeWith, MergeResult mergeResult) throws MergeMappingException {
|
||||
if (((AllFieldMapper)mergeWith).enabled() != this.enabled() && ((AllFieldMapper)mergeWith).enabledState != Defaults.ENABLED) {
|
||||
mergeResult.addConflict("mapper [" + fieldType.names().fullName() + "] enabled is " + this.enabled() + " now encountering "+ ((AllFieldMapper)mergeWith).enabled());
|
||||
mergeResult.addConflict("mapper [" + fieldType().names().fullName() + "] enabled is " + this.enabled() + " now encountering "+ ((AllFieldMapper)mergeWith).enabled());
|
||||
}
|
||||
super.merge(mergeWith, mergeResult);
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.index.mapper.internal;
|
|||
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.index.IndexableField;
|
||||
import org.elasticsearch.Version;
|
||||
|
@ -39,7 +38,6 @@ import org.elasticsearch.index.mapper.MergeResult;
|
|||
import org.elasticsearch.index.mapper.ParseContext;
|
||||
import org.elasticsearch.index.mapper.RootMapper;
|
||||
import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
||||
import org.elasticsearch.search.highlight.HighlightBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -201,15 +199,15 @@ public class FieldNamesFieldMapper extends AbstractFieldMapper implements RootMa
|
|||
this.defaultFieldType = Defaults.FIELD_TYPE;
|
||||
this.pre13Index = Version.indexCreated(indexSettings).before(Version.V_1_3_0);
|
||||
if (this.pre13Index) {
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType = fieldType().clone();
|
||||
fieldType().setEnabled(false);
|
||||
this.fieldType.freeze();
|
||||
fieldType().freeze();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FieldNamesFieldType fieldType() {
|
||||
return (FieldNamesFieldType)fieldType;
|
||||
return (FieldNamesFieldType) super.fieldType();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -281,8 +279,8 @@ public class FieldNamesFieldMapper extends AbstractFieldMapper implements RootMa
|
|||
}
|
||||
for (String path : paths) {
|
||||
for (String fieldName : extractFieldNames(path)) {
|
||||
if (fieldType.indexOptions() != IndexOptions.NONE || fieldType.stored()) {
|
||||
document.add(new Field(fieldType().names().indexName(), fieldName, fieldType));
|
||||
if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
|
||||
document.add(new Field(fieldType().names().indexName(), fieldName, fieldType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.lucene.search.MultiTermQuery;
|
|||
import org.apache.lucene.search.PrefixQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.RegexpQuery;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
|
@ -288,11 +287,11 @@ public class IdFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
context.id(id);
|
||||
} // else we are in the pre/post parse phase
|
||||
|
||||
if (fieldType.indexOptions() != IndexOptions.NONE || fieldType.stored()) {
|
||||
fields.add(new Field(fieldType.names().indexName(), context.id(), fieldType));
|
||||
if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
|
||||
fields.add(new Field(fieldType().names().indexName(), context.id(), fieldType()));
|
||||
}
|
||||
if (fieldType().hasDocValues()) {
|
||||
fields.add(new BinaryDocValuesField(fieldType.names().indexName(), new BytesRef(context.id())));
|
||||
fields.add(new BinaryDocValuesField(fieldType().names().indexName(), new BytesRef(context.id())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,18 +308,18 @@ public class IdFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
||||
|
||||
// if all are defaults, no sense to write it at all
|
||||
if (!includeDefaults && fieldType.stored() == Defaults.FIELD_TYPE.stored()
|
||||
&& fieldType.indexOptions() == Defaults.FIELD_TYPE.indexOptions()
|
||||
if (!includeDefaults && fieldType().stored() == Defaults.FIELD_TYPE.stored()
|
||||
&& fieldType().indexOptions() == Defaults.FIELD_TYPE.indexOptions()
|
||||
&& path == Defaults.PATH
|
||||
&& customFieldDataSettings == null) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (includeDefaults || fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
if (includeDefaults || fieldType().stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
if (includeDefaults || fieldType.indexOptions() != Defaults.FIELD_TYPE.indexOptions()) {
|
||||
builder.field("index", indexTokenizeOptionToString(fieldType.indexOptions() != IndexOptions.NONE, fieldType.tokenized()));
|
||||
if (includeDefaults || fieldType().indexOptions() != Defaults.FIELD_TYPE.indexOptions()) {
|
||||
builder.field("index", indexTokenizeOptionToString(fieldType().indexOptions() != IndexOptions.NONE, fieldType().tokenized()));
|
||||
}
|
||||
if (includeDefaults || path != Defaults.PATH) {
|
||||
builder.field("path", path);
|
||||
|
@ -329,7 +328,7 @@ public class IdFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
if (customFieldDataSettings != null) {
|
||||
builder.field("fielddata", (Map) customFieldDataSettings.getAsMap());
|
||||
} else if (includeDefaults) {
|
||||
builder.field("fielddata", (Map) fieldType.fieldDataType().getSettings().getAsMap());
|
||||
builder.field("fielddata", (Map) fieldType().fieldDataType().getSettings().getAsMap());
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.index.mapper.MergeResult;
|
|||
import org.elasticsearch.index.mapper.ParseContext;
|
||||
import org.elasticsearch.index.mapper.RootMapper;
|
||||
import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
||||
import org.elasticsearch.search.highlight.HighlightBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
@ -170,7 +169,7 @@ public class IndexFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
}
|
||||
|
||||
public String value(Document document) {
|
||||
Field field = (Field) document.getField(fieldType.names().indexName());
|
||||
Field field = (Field) document.getField(fieldType().names().indexName());
|
||||
return field == null ? null : (String)fieldType().value(field);
|
||||
}
|
||||
|
||||
|
@ -194,7 +193,7 @@ public class IndexFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
if (!enabledState.enabled) {
|
||||
return;
|
||||
}
|
||||
fields.add(new Field(fieldType.names().indexName(), context.index(), fieldType));
|
||||
fields.add(new Field(fieldType().names().indexName(), context.index(), fieldType()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -222,7 +221,7 @@ public class IndexFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
if (customFieldDataSettings != null) {
|
||||
builder.field("fielddata", (Map) customFieldDataSettings.getAsMap());
|
||||
} else if (includeDefaults) {
|
||||
builder.field("fielddata", (Map) fieldType.fieldDataType().getSettings().getAsMap());
|
||||
builder.field("fielddata", (Map) fieldType().fieldDataType().getSettings().getAsMap());
|
||||
}
|
||||
}
|
||||
builder.endObject();
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.index.mapper.internal;
|
|||
|
||||
import com.google.common.base.Objects;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
import org.apache.lucene.document.SortedDocValuesField;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.queries.TermsQuery;
|
||||
|
@ -237,9 +236,9 @@ public class ParentFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
|
||||
public ParentFieldMapper(Settings indexSettings) {
|
||||
this(Defaults.FIELD_TYPE.clone(), null, null, indexSettings);
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType.setFieldDataType(new FieldDataType("_parent", settingsBuilder().put(MappedFieldType.Loading.KEY, MappedFieldType.Loading.LAZY_VALUE)));
|
||||
this.fieldType.freeze();
|
||||
this.fieldType = this.fieldType().clone();
|
||||
this.fieldType().setFieldDataType(new FieldDataType("_parent", settingsBuilder().put(MappedFieldType.Loading.KEY, MappedFieldType.Loading.LAZY_VALUE)));
|
||||
this.fieldType().freeze();
|
||||
}
|
||||
|
||||
public String type() {
|
||||
|
@ -268,7 +267,7 @@ public class ParentFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
@Override
|
||||
protected void parseCreateField(ParseContext context, List<Field> fields) throws IOException {
|
||||
boolean parent = context.docMapper().isParent(context.type());
|
||||
if (parent && fieldType.hasDocValues()) {
|
||||
if (parent && fieldType().hasDocValues()) {
|
||||
fields.add(createJoinField(context.type(), context.id()));
|
||||
}
|
||||
|
||||
|
@ -280,8 +279,8 @@ public class ParentFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
// we are in the parsing of _parent phase
|
||||
String parentId = context.parser().text();
|
||||
context.sourceToParse().parent(parentId);
|
||||
fields.add(new Field(fieldType.names().indexName(), Uid.createUid(context.stringBuilder(), type, parentId), fieldType));
|
||||
if (fieldType.hasDocValues()) {
|
||||
fields.add(new Field(fieldType().names().indexName(), Uid.createUid(context.stringBuilder(), type, parentId), fieldType()));
|
||||
if (fieldType().hasDocValues()) {
|
||||
fields.add(createJoinField(type, parentId));
|
||||
}
|
||||
} else {
|
||||
|
@ -294,8 +293,8 @@ public class ParentFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
throw new MapperParsingException("No parent id provided, not within the document, and not externally");
|
||||
}
|
||||
// we did not add it in the parsing phase, add it now
|
||||
fields.add(new Field(fieldType.names().indexName(), Uid.createUid(context.stringBuilder(), type, parentId), fieldType));
|
||||
if (fieldType.hasDocValues()) {
|
||||
fields.add(new Field(fieldType().names().indexName(), Uid.createUid(context.stringBuilder(), type, parentId), fieldType()));
|
||||
if (fieldType().hasDocValues()) {
|
||||
fields.add(createJoinField(type, parentId));
|
||||
}
|
||||
} else if (parentId != null && !parsedParentId.equals(Uid.createUid(context.stringBuilder(), type, parentId))) {
|
||||
|
@ -332,7 +331,7 @@ public class ParentFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
if (customFieldDataSettings != null) {
|
||||
builder.field("fielddata", (Map) customFieldDataSettings.getAsMap());
|
||||
} else if (includeDefaults) {
|
||||
builder.field("fielddata", (Map) fieldType.fieldDataType().getSettings().getAsMap());
|
||||
builder.field("fielddata", (Map) fieldType().fieldDataType().getSettings().getAsMap());
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
@ -347,16 +346,16 @@ public class ParentFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
|
||||
if (!mergeResult.simulate()) {
|
||||
ParentFieldMapper fieldMergeWith = (ParentFieldMapper) mergeWith;
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType = this.fieldType().clone();
|
||||
if (fieldMergeWith.customFieldDataSettings != null) {
|
||||
if (!Objects.equal(fieldMergeWith.customFieldDataSettings, this.customFieldDataSettings)) {
|
||||
this.customFieldDataSettings = fieldMergeWith.customFieldDataSettings;
|
||||
this.fieldType.setFieldDataType(new FieldDataType(defaultFieldDataType().getType(),
|
||||
builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings)
|
||||
this.fieldType().setFieldDataType(new FieldDataType(defaultFieldDataType().getType(),
|
||||
builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings)
|
||||
));
|
||||
}
|
||||
}
|
||||
this.fieldType.freeze();
|
||||
this.fieldType().freeze();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ public class RoutingFieldMapper extends AbstractFieldMapper implements RootMappe
|
|||
}
|
||||
|
||||
public String value(Document document) {
|
||||
Field field = (Field) document.getField(fieldType.names().indexName());
|
||||
Field field = (Field) document.getField(fieldType().names().indexName());
|
||||
return field == null ? null : (String)fieldType().value(field);
|
||||
}
|
||||
|
||||
|
@ -210,11 +210,11 @@ public class RoutingFieldMapper extends AbstractFieldMapper implements RootMappe
|
|||
if (context.sourceToParse().routing() != null) {
|
||||
String routing = context.sourceToParse().routing();
|
||||
if (routing != null) {
|
||||
if (fieldType.indexOptions() == IndexOptions.NONE && !fieldType.stored()) {
|
||||
context.ignoredValue(fieldType.names().indexName(), routing);
|
||||
if (fieldType().indexOptions() == IndexOptions.NONE && !fieldType().stored()) {
|
||||
context.ignoredValue(fieldType().names().indexName(), routing);
|
||||
return;
|
||||
}
|
||||
fields.add(new Field(fieldType.names().indexName(), routing, fieldType));
|
||||
fields.add(new Field(fieldType().names().indexName(), routing, fieldType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -229,18 +229,18 @@ public class RoutingFieldMapper extends AbstractFieldMapper implements RootMappe
|
|||
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
||||
|
||||
// if all are defaults, no sense to write it at all
|
||||
boolean indexed = fieldType.indexOptions() != IndexOptions.NONE;
|
||||
boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
|
||||
boolean indexedDefault = Defaults.FIELD_TYPE.indexOptions() != IndexOptions.NONE;
|
||||
if (!includeDefaults && indexed == indexedDefault &&
|
||||
fieldType.stored() == Defaults.FIELD_TYPE.stored() && required == Defaults.REQUIRED && path == Defaults.PATH) {
|
||||
fieldType().stored() == Defaults.FIELD_TYPE.stored() && required == Defaults.REQUIRED && path == Defaults.PATH) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (indexCreatedBefore2x && (includeDefaults || indexed != indexedDefault)) {
|
||||
builder.field("index", indexTokenizeOptionToString(indexed, fieldType.tokenized()));
|
||||
builder.field("index", indexTokenizeOptionToString(indexed, fieldType().tokenized()));
|
||||
}
|
||||
if (indexCreatedBefore2x && (includeDefaults || fieldType.stored() != Defaults.FIELD_TYPE.stored())) {
|
||||
builder.field("store", fieldType.stored());
|
||||
if (indexCreatedBefore2x && (includeDefaults || fieldType().stored() != Defaults.FIELD_TYPE.stored())) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
if (includeDefaults || required != Defaults.REQUIRED) {
|
||||
builder.field("required", required);
|
||||
|
|
|
@ -313,7 +313,7 @@ public class SourceFieldMapper extends AbstractFieldMapper implements RootMapper
|
|||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
if (!fieldType.stored()) {
|
||||
if (!fieldType().stored()) {
|
||||
return;
|
||||
}
|
||||
if (context.flyweight()) {
|
||||
|
|
|
@ -178,12 +178,12 @@ public class TypeFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
|
||||
@Override
|
||||
protected void parseCreateField(ParseContext context, List<Field> fields) throws IOException {
|
||||
if (fieldType.indexOptions() == IndexOptions.NONE && !fieldType.stored()) {
|
||||
if (fieldType().indexOptions() == IndexOptions.NONE && !fieldType().stored()) {
|
||||
return;
|
||||
}
|
||||
fields.add(new Field(fieldType.names().indexName(), context.type(), fieldType));
|
||||
fields.add(new Field(fieldType().names().indexName(), context.type(), fieldType()));
|
||||
if (fieldType().hasDocValues()) {
|
||||
fields.add(new SortedSetDocValuesField(fieldType.names().indexName(), new BytesRef(context.type())));
|
||||
fields.add(new SortedSetDocValuesField(fieldType().names().indexName(), new BytesRef(context.type())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,17 +200,17 @@ public class TypeFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
boolean includeDefaults = params.paramAsBoolean("include_defaults", false);
|
||||
|
||||
// if all are defaults, no sense to write it at all
|
||||
boolean indexed = fieldType.indexOptions() != IndexOptions.NONE;
|
||||
boolean indexed = fieldType().indexOptions() != IndexOptions.NONE;
|
||||
boolean defaultIndexed = Defaults.FIELD_TYPE.indexOptions() != IndexOptions.NONE;
|
||||
if (!includeDefaults && fieldType.stored() == Defaults.FIELD_TYPE.stored() && indexed == defaultIndexed) {
|
||||
if (!includeDefaults && fieldType().stored() == Defaults.FIELD_TYPE.stored() && indexed == defaultIndexed) {
|
||||
return builder;
|
||||
}
|
||||
builder.startObject(CONTENT_TYPE);
|
||||
if (includeDefaults || fieldType.stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType.stored());
|
||||
if (includeDefaults || fieldType().stored() != Defaults.FIELD_TYPE.stored()) {
|
||||
builder.field("store", fieldType().stored());
|
||||
}
|
||||
if (includeDefaults || indexed != defaultIndexed) {
|
||||
builder.field("index", indexTokenizeOptionToString(indexed, fieldType.tokenized()));
|
||||
builder.field("index", indexTokenizeOptionToString(indexed, fieldType().tokenized()));
|
||||
}
|
||||
builder.endObject();
|
||||
return builder;
|
||||
|
|
|
@ -229,7 +229,7 @@ public class UidFieldMapper extends AbstractFieldMapper implements RootMapper {
|
|||
if (customFieldDataSettings != null) {
|
||||
builder.field("fielddata", (Map) customFieldDataSettings.getAsMap());
|
||||
} else if (includeDefaults) {
|
||||
builder.field("fielddata", (Map) fieldType.fieldDataType().getSettings().getAsMap());
|
||||
builder.field("fielddata", (Map) fieldType().fieldDataType().getSettings().getAsMap());
|
||||
}
|
||||
|
||||
builder.endObject();
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.google.common.net.InetAddresses;
|
|||
import org.apache.lucene.analysis.NumericTokenStream;
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.index.IndexOptions;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.NumericRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
|
@ -275,13 +274,13 @@ public class IpFieldMapper extends NumberFieldMapper {
|
|||
return;
|
||||
}
|
||||
if (context.includeInAll(includeInAll, this)) {
|
||||
context.allEntries().addText(fieldType.names().fullName(), ipAsString, fieldType.boost());
|
||||
context.allEntries().addText(fieldType().names().fullName(), ipAsString, fieldType().boost());
|
||||
}
|
||||
|
||||
final long value = ipToLong(ipAsString);
|
||||
if (fieldType.indexOptions() != IndexOptions.NONE || fieldType.stored()) {
|
||||
CustomLongNumericField field = new CustomLongNumericField(this, value, fieldType);
|
||||
field.setBoost(fieldType.boost());
|
||||
if (fieldType().indexOptions() != IndexOptions.NONE || fieldType().stored()) {
|
||||
CustomLongNumericField field = new CustomLongNumericField(this, value, fieldType());
|
||||
field.setBoost(fieldType().boost());
|
||||
fields.add(field);
|
||||
}
|
||||
if (fieldType().hasDocValues()) {
|
||||
|
@ -301,8 +300,8 @@ public class IpFieldMapper extends NumberFieldMapper {
|
|||
return;
|
||||
}
|
||||
if (!mergeResult.simulate()) {
|
||||
this.fieldType = this.fieldType.clone();
|
||||
this.fieldType.setNullValue(((IpFieldMapper) mergeWith).fieldType().nullValue());
|
||||
this.fieldType = this.fieldType().clone();
|
||||
this.fieldType().setNullValue(((IpFieldMapper) mergeWith).fieldType().nullValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,8 +309,8 @@ public class IpFieldMapper extends NumberFieldMapper {
|
|||
protected void doXContentBody(XContentBuilder builder, boolean includeDefaults, Params params) throws IOException {
|
||||
super.doXContentBody(builder, includeDefaults, params);
|
||||
|
||||
if (includeDefaults || fieldType.numericPrecisionStep() != Defaults.PRECISION_STEP_64_BIT) {
|
||||
builder.field("precision_step", fieldType.numericPrecisionStep());
|
||||
if (includeDefaults || fieldType().numericPrecisionStep() != Defaults.PRECISION_STEP_64_BIT) {
|
||||
builder.field("precision_step", fieldType().numericPrecisionStep());
|
||||
}
|
||||
if (includeDefaults || fieldType().nullValueAsString() != null) {
|
||||
builder.field("null_value", fieldType().nullValueAsString());
|
||||
|
|
Loading…
Reference in New Issue