expose field data settings in mapping, they can be updated using merge mapping
This commit is contained in:
parent
4eefcb9c82
commit
9673a1c366
|
@ -33,10 +33,13 @@ import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.search.RegexpFilter;
|
import org.elasticsearch.common.lucene.search.RegexpFilter;
|
||||||
import org.elasticsearch.common.lucene.search.TermFilter;
|
import org.elasticsearch.common.lucene.search.TermFilter;
|
||||||
import org.elasticsearch.common.lucene.search.XTermsFilter;
|
import org.elasticsearch.common.lucene.search.XTermsFilter;
|
||||||
|
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingFormats;
|
import org.elasticsearch.index.codec.postingsformat.PostingFormats;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
import org.elasticsearch.index.query.QueryParseContext;
|
import org.elasticsearch.index.query.QueryParseContext;
|
||||||
import org.elasticsearch.index.similarity.SimilarityProvider;
|
import org.elasticsearch.index.similarity.SimilarityProvider;
|
||||||
|
@ -140,6 +143,10 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
public T similarity(SimilarityProvider similarity) {
|
public T similarity(SimilarityProvider similarity) {
|
||||||
return super.similarity(similarity);
|
return super.similarity(similarity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T fieldDataSettings(String settings) {
|
||||||
|
return super.fieldDataSettings(settings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class Builder<T extends Builder, Y extends AbstractFieldMapper> extends Mapper.Builder<T, Y> {
|
public abstract static class Builder<T extends Builder, Y extends AbstractFieldMapper> extends Mapper.Builder<T, Y> {
|
||||||
|
@ -154,6 +161,8 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
protected boolean indexOptionsSet = false;
|
protected boolean indexOptionsSet = false;
|
||||||
protected PostingsFormatProvider provider;
|
protected PostingsFormatProvider provider;
|
||||||
protected SimilarityProvider similarity;
|
protected SimilarityProvider similarity;
|
||||||
|
@Nullable
|
||||||
|
protected Settings fieldDataSettings;
|
||||||
|
|
||||||
protected Builder(String name, FieldType fieldType) {
|
protected Builder(String name, FieldType fieldType) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -245,6 +254,11 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected T fieldDataSettings(String settings) {
|
||||||
|
this.fieldDataSettings = ImmutableSettings.builder().loadFromDelimitedString(settings, ';').build();
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
|
||||||
protected Names buildNames(BuilderContext context) {
|
protected Names buildNames(BuilderContext context) {
|
||||||
return new Names(name, buildIndexName(context), indexName == null ? name : indexName, buildFullName(context), context.path().sourcePath());
|
return new Names(name, buildIndexName(context), indexName == null ? name : indexName, buildFullName(context), context.path().sourcePath());
|
||||||
}
|
}
|
||||||
|
@ -267,8 +281,12 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
protected PostingsFormatProvider postingsFormat;
|
protected PostingsFormatProvider postingsFormat;
|
||||||
protected final SimilarityProvider similarity;
|
protected final SimilarityProvider similarity;
|
||||||
|
|
||||||
|
protected Settings customFieldDataSettings;
|
||||||
|
protected FieldDataType fieldDataType;
|
||||||
|
|
||||||
protected AbstractFieldMapper(Names names, float boost, FieldType fieldType, NamedAnalyzer indexAnalyzer,
|
protected AbstractFieldMapper(Names names, float boost, FieldType fieldType, NamedAnalyzer indexAnalyzer,
|
||||||
NamedAnalyzer searchAnalyzer, PostingsFormatProvider postingsFormat, SimilarityProvider similarity) {
|
NamedAnalyzer searchAnalyzer, PostingsFormatProvider postingsFormat, SimilarityProvider similarity,
|
||||||
|
@Nullable Settings fieldDataSettings) {
|
||||||
this.names = names;
|
this.names = names;
|
||||||
this.boost = boost;
|
this.boost = boost;
|
||||||
this.fieldType = fieldType;
|
this.fieldType = fieldType;
|
||||||
|
@ -293,6 +311,16 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
}
|
}
|
||||||
this.postingsFormat = postingsFormat;
|
this.postingsFormat = postingsFormat;
|
||||||
this.similarity = similarity;
|
this.similarity = similarity;
|
||||||
|
|
||||||
|
this.customFieldDataSettings = fieldDataSettings;
|
||||||
|
if (fieldDataSettings == null) {
|
||||||
|
this.fieldDataType = defaultFieldDataType();
|
||||||
|
} else {
|
||||||
|
// create a new field data type, with the default settings as well as the "new ones"
|
||||||
|
this.fieldDataType = new FieldDataType(defaultFieldDataType().getType(),
|
||||||
|
ImmutableSettings.builder().put(defaultFieldDataType().getSettings()).put(fieldDataSettings)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -312,6 +340,13 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
|
|
||||||
public abstract FieldType defaultFieldType();
|
public abstract FieldType defaultFieldType();
|
||||||
|
|
||||||
|
public abstract FieldDataType defaultFieldDataType();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final FieldDataType fieldDataType() {
|
||||||
|
return fieldDataType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldType fieldType() {
|
public FieldType fieldType() {
|
||||||
return fieldType;
|
return fieldType;
|
||||||
|
@ -547,6 +582,12 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
if (fieldMergeWith.postingsFormat != null) {
|
if (fieldMergeWith.postingsFormat != null) {
|
||||||
this.postingsFormat = fieldMergeWith.postingsFormat;
|
this.postingsFormat = fieldMergeWith.postingsFormat;
|
||||||
}
|
}
|
||||||
|
if (fieldMergeWith.customFieldDataSettings != null) {
|
||||||
|
this.customFieldDataSettings = fieldMergeWith.customFieldDataSettings;
|
||||||
|
this.fieldDataType = new FieldDataType(defaultFieldDataType().getType(),
|
||||||
|
ImmutableSettings.builder().put(defaultFieldDataType().getSettings()).put(this.customFieldDataSettings)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,6 +661,10 @@ public abstract class AbstractFieldMapper<T> implements FieldMapper<T>, Mapper {
|
||||||
if (similarity() != null) {
|
if (similarity() != null) {
|
||||||
builder.field("similarity", similarity().name());
|
builder.field("similarity", similarity().name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (customFieldDataSettings != null) {
|
||||||
|
builder.field("fielddata", customFieldDataSettings.toDelimitedString(';'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String indexOptionToString(IndexOptions indexOption) {
|
protected static String indexOptionToString(IndexOptions indexOption) {
|
||||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.index.mapper.core;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
|
||||||
import org.elasticsearch.ElasticSearchParseException;
|
import org.elasticsearch.ElasticSearchParseException;
|
||||||
import org.elasticsearch.common.Base64;
|
import org.elasticsearch.common.Base64;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
@ -35,6 +34,7 @@ import org.elasticsearch.common.unit.ByteSizeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -123,7 +123,7 @@ public class BinaryFieldMapper extends AbstractFieldMapper<BytesReference> {
|
||||||
private long compressThreshold;
|
private long compressThreshold;
|
||||||
|
|
||||||
protected BinaryFieldMapper(Names names, FieldType fieldType, Boolean compress, long compressThreshold, PostingsFormatProvider provider) {
|
protected BinaryFieldMapper(Names names, FieldType fieldType, Boolean compress, long compressThreshold, PostingsFormatProvider provider) {
|
||||||
super(names, 1.0f, fieldType, null, null, provider, null);
|
super(names, 1.0f, fieldType, null, null, provider, null, null);
|
||||||
this.compress = compress;
|
this.compress = compress;
|
||||||
this.compressThreshold = compressThreshold;
|
this.compressThreshold = compressThreshold;
|
||||||
}
|
}
|
||||||
|
@ -134,8 +134,8 @@ public class BinaryFieldMapper extends AbstractFieldMapper<BytesReference> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
throw new ElasticSearchIllegalArgumentException("field data on binary field is not supported");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,9 +24,11 @@ import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.search.Filter;
|
import org.apache.lucene.search.Filter;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.elasticsearch.common.Booleans;
|
import org.elasticsearch.common.Booleans;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.search.TermFilter;
|
import org.elasticsearch.common.lucene.search.TermFilter;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
@ -128,7 +130,7 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BooleanFieldMapper build(BuilderContext context) {
|
public BooleanFieldMapper build(BuilderContext context) {
|
||||||
return new BooleanFieldMapper(buildNames(context), boost, fieldType, nullValue, provider, similarity);
|
return new BooleanFieldMapper(buildNames(context), boost, fieldType, nullValue, provider, similarity, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,8 +152,8 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
|
||||||
|
|
||||||
private Boolean nullValue;
|
private Boolean nullValue;
|
||||||
|
|
||||||
protected BooleanFieldMapper(Names names, float boost, FieldType fieldType, Boolean nullValue, PostingsFormatProvider provider, SimilarityProvider similarity) {
|
protected BooleanFieldMapper(Names names, float boost, FieldType fieldType, Boolean nullValue, PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, boost, fieldType, Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, provider, similarity);
|
super(names, boost, fieldType, Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,7 +163,7 @@ public class BooleanFieldMapper extends AbstractFieldMapper<Boolean> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
// TODO have a special boolean type?
|
// TODO have a special boolean type?
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||||
import org.elasticsearch.common.Explicit;
|
import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
|
@ -89,7 +90,7 @@ public class ByteFieldMapper extends NumberFieldMapper<Byte> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
ByteFieldMapper fieldMapper = new ByteFieldMapper(buildNames(context),
|
ByteFieldMapper fieldMapper = new ByteFieldMapper(buildNames(context),
|
||||||
precisionStep, fuzzyFactor, boost, fieldType, nullValue, ignoreMalformed(context),
|
precisionStep, fuzzyFactor, boost, fieldType, nullValue, ignoreMalformed(context),
|
||||||
provider, similarity);
|
provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -116,10 +117,10 @@ public class ByteFieldMapper extends NumberFieldMapper<Byte> {
|
||||||
private String nullValueAsString;
|
private String nullValueAsString;
|
||||||
|
|
||||||
protected ByteFieldMapper(Names names, int precisionStep, String fuzzyFactor, float boost, FieldType fieldType,
|
protected ByteFieldMapper(Names names, int precisionStep, String fuzzyFactor, float boost, FieldType fieldType,
|
||||||
Byte nullValue, Explicit<Boolean> ignoreMalformed, PostingsFormatProvider provider, SimilarityProvider similarity) {
|
Byte nullValue, Explicit<Boolean> ignoreMalformed, PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_byte/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_byte/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_byte/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_byte/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
||||||
}
|
}
|
||||||
|
@ -130,7 +131,7 @@ public class ByteFieldMapper extends NumberFieldMapper<Byte> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("byte");
|
return new FieldDataType("byte");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.joda.DateMathParser;
|
import org.elasticsearch.common.joda.DateMathParser;
|
||||||
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
||||||
import org.elasticsearch.common.joda.Joda;
|
import org.elasticsearch.common.joda.Joda;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
@ -116,7 +117,7 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
DateFieldMapper fieldMapper = new DateFieldMapper(buildNames(context), dateTimeFormatter,
|
DateFieldMapper fieldMapper = new DateFieldMapper(buildNames(context), dateTimeFormatter,
|
||||||
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
||||||
timeUnit, parseUpperInclusive, ignoreMalformed(context), provider, similarity);
|
timeUnit, parseUpperInclusive, ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -155,12 +156,12 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
|
||||||
protected DateFieldMapper(Names names, FormatDateTimeFormatter dateTimeFormatter, int precisionStep, String fuzzyFactor,
|
protected DateFieldMapper(Names names, FormatDateTimeFormatter dateTimeFormatter, int precisionStep, String fuzzyFactor,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
String nullValue, TimeUnit timeUnit, boolean parseUpperInclusive, Explicit<Boolean> ignoreMalformed,
|
String nullValue, TimeUnit timeUnit, boolean parseUpperInclusive, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider, SimilarityProvider similarity) {
|
PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_date/" + precisionStep,
|
ignoreMalformed, new NamedAnalyzer("_date/" + precisionStep,
|
||||||
new NumericDateAnalyzer(precisionStep, dateTimeFormatter.parser())),
|
new NumericDateAnalyzer(precisionStep, dateTimeFormatter.parser())),
|
||||||
new NamedAnalyzer("_date/max", new NumericDateAnalyzer(Integer.MAX_VALUE, dateTimeFormatter.parser())),
|
new NamedAnalyzer("_date/max", new NumericDateAnalyzer(Integer.MAX_VALUE, dateTimeFormatter.parser())),
|
||||||
provider, similarity);
|
provider, similarity, fieldDataSettings);
|
||||||
this.dateTimeFormatter = dateTimeFormatter;
|
this.dateTimeFormatter = dateTimeFormatter;
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.timeUnit = timeUnit;
|
this.timeUnit = timeUnit;
|
||||||
|
@ -174,7 +175,7 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("long");
|
return new FieldDataType("long");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||||
import org.elasticsearch.common.Explicit;
|
import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
|
@ -89,7 +90,7 @@ public class DoubleFieldMapper extends NumberFieldMapper<Double> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
DoubleFieldMapper fieldMapper = new DoubleFieldMapper(buildNames(context),
|
DoubleFieldMapper fieldMapper = new DoubleFieldMapper(buildNames(context),
|
||||||
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
||||||
ignoreMalformed(context), provider, similarity);
|
ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -119,10 +120,10 @@ public class DoubleFieldMapper extends NumberFieldMapper<Double> {
|
||||||
protected DoubleFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
protected DoubleFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
Double nullValue, Explicit<Boolean> ignoreMalformed,
|
Double nullValue, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider, SimilarityProvider similarity) {
|
PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_double/" + precisionStep, new NumericDoubleAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_double/" + precisionStep, new NumericDoubleAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_double/max", new NumericDoubleAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_double/max", new NumericDoubleAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,7 @@ public class DoubleFieldMapper extends NumberFieldMapper<Double> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("double");
|
return new FieldDataType("double");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
|
@ -90,7 +91,7 @@ public class FloatFieldMapper extends NumberFieldMapper<Float> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
FloatFieldMapper fieldMapper = new FloatFieldMapper(buildNames(context),
|
FloatFieldMapper fieldMapper = new FloatFieldMapper(buildNames(context),
|
||||||
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
||||||
ignoreMalformed(context), provider, similarity);
|
ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -117,10 +118,10 @@ public class FloatFieldMapper extends NumberFieldMapper<Float> {
|
||||||
private String nullValueAsString;
|
private String nullValueAsString;
|
||||||
|
|
||||||
protected FloatFieldMapper(Names names, int precisionStep, String fuzzyFactor, float boost, FieldType fieldType,
|
protected FloatFieldMapper(Names names, int precisionStep, String fuzzyFactor, float boost, FieldType fieldType,
|
||||||
Float nullValue, Explicit<Boolean> ignoreMalformed, PostingsFormatProvider provider, SimilarityProvider similarity) {
|
Float nullValue, Explicit<Boolean> ignoreMalformed, PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_float/" + precisionStep, new NumericFloatAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_float/" + precisionStep, new NumericFloatAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_float/max", new NumericFloatAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_float/max", new NumericFloatAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
||||||
}
|
}
|
||||||
|
@ -131,7 +132,7 @@ public class FloatFieldMapper extends NumberFieldMapper<Float> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("float");
|
return new FieldDataType("float");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,13 @@ import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
|
@ -89,7 +91,7 @@ public class IntegerFieldMapper extends NumberFieldMapper<Integer> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
IntegerFieldMapper fieldMapper = new IntegerFieldMapper(buildNames(context),
|
IntegerFieldMapper fieldMapper = new IntegerFieldMapper(buildNames(context),
|
||||||
precisionStep, fuzzyFactor, boost, fieldType,
|
precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
nullValue, ignoreMalformed(context), provider, similarity);
|
nullValue, ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -118,10 +120,10 @@ public class IntegerFieldMapper extends NumberFieldMapper<Integer> {
|
||||||
protected IntegerFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
protected IntegerFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
Integer nullValue, Explicit<Boolean> ignoreMalformed,
|
Integer nullValue, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider, SimilarityProvider similarity) {
|
PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_int/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_int/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_int/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_int/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
||||||
}
|
}
|
||||||
|
@ -132,8 +134,8 @@ public class IntegerFieldMapper extends NumberFieldMapper<Integer> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new org.elasticsearch.index.fielddata.FieldDataType("int");
|
return new FieldDataType("int");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
|
@ -90,7 +91,7 @@ public class LongFieldMapper extends NumberFieldMapper<Long> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
LongFieldMapper fieldMapper = new LongFieldMapper(buildNames(context),
|
LongFieldMapper fieldMapper = new LongFieldMapper(buildNames(context),
|
||||||
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
||||||
ignoreMalformed(context), provider, similarity);
|
ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -119,10 +120,10 @@ public class LongFieldMapper extends NumberFieldMapper<Long> {
|
||||||
protected LongFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
protected LongFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
Long nullValue, Explicit<Boolean> ignoreMalformed,
|
Long nullValue, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider, SimilarityProvider similarity) {
|
PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_long/" + precisionStep, new NumericLongAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_long/" + precisionStep, new NumericLongAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_long/max", new NumericLongAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_long/max", new NumericLongAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,7 @@ public class LongFieldMapper extends NumberFieldMapper<Long> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("long");
|
return new FieldDataType("long");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.util.NumericUtils;
|
import org.apache.lucene.util.NumericUtils;
|
||||||
import org.elasticsearch.common.Explicit;
|
import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
@ -140,9 +141,10 @@ public abstract class NumberFieldMapper<T extends Number> extends AbstractFieldM
|
||||||
protected NumberFieldMapper(Names names, int precisionStep, @Nullable String fuzzyFactor,
|
protected NumberFieldMapper(Names names, int precisionStep, @Nullable String fuzzyFactor,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
Explicit<Boolean> ignoreMalformed, NamedAnalyzer indexAnalyzer,
|
Explicit<Boolean> ignoreMalformed, NamedAnalyzer indexAnalyzer,
|
||||||
NamedAnalyzer searchAnalyzer, PostingsFormatProvider provider, SimilarityProvider similarity) {
|
NamedAnalyzer searchAnalyzer, PostingsFormatProvider provider, SimilarityProvider similarity,
|
||||||
|
@Nullable Settings fieldDataSettings) {
|
||||||
// LUCENE 4 UPGRADE: Since we can't do anything before the super call, we have to push the boost check down to subclasses
|
// LUCENE 4 UPGRADE: Since we can't do anything before the super call, we have to push the boost check down to subclasses
|
||||||
super(names, boost, fieldType, indexAnalyzer, searchAnalyzer, provider, similarity);
|
super(names, boost, fieldType, indexAnalyzer, searchAnalyzer, provider, similarity, fieldDataSettings);
|
||||||
if (precisionStep <= 0 || precisionStep >= maxPrecisionStep()) {
|
if (precisionStep <= 0 || precisionStep >= maxPrecisionStep()) {
|
||||||
this.precisionStep = Integer.MAX_VALUE;
|
this.precisionStep = Integer.MAX_VALUE;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,11 +34,13 @@ import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
import org.elasticsearch.index.analysis.NumericIntegerAnalyzer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
|
@ -89,7 +91,7 @@ public class ShortFieldMapper extends NumberFieldMapper<Short> {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
ShortFieldMapper fieldMapper = new ShortFieldMapper(buildNames(context),
|
ShortFieldMapper fieldMapper = new ShortFieldMapper(buildNames(context),
|
||||||
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
precisionStep, fuzzyFactor, boost, fieldType, nullValue,
|
||||||
ignoreMalformed(context), provider, similarity);
|
ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -118,10 +120,10 @@ public class ShortFieldMapper extends NumberFieldMapper<Short> {
|
||||||
protected ShortFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
protected ShortFieldMapper(Names names, int precisionStep, String fuzzyFactor,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
Short nullValue, Explicit<Boolean> ignoreMalformed,
|
Short nullValue, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider, SimilarityProvider similarity) {
|
PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
super(names, precisionStep, fuzzyFactor, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_short/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_short/" + precisionStep, new NumericIntegerAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_short/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_short/max", new NumericIntegerAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
this.nullValueAsString = nullValue == null ? null : nullValue.toString();
|
||||||
}
|
}
|
||||||
|
@ -132,8 +134,8 @@ public class ShortFieldMapper extends NumberFieldMapper<Short> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new org.elasticsearch.index.fielddata.FieldDataType("short");
|
return new FieldDataType("short");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,7 +28,9 @@ import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||||
import org.apache.lucene.search.Filter;
|
import org.apache.lucene.search.Filter;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
|
@ -136,7 +138,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
||||||
}
|
}
|
||||||
StringFieldMapper fieldMapper = new StringFieldMapper(buildNames(context),
|
StringFieldMapper fieldMapper = new StringFieldMapper(buildNames(context),
|
||||||
boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, searchQuotedAnalyzer,
|
boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, searchQuotedAnalyzer,
|
||||||
positionOffsetGap, ignoreAbove, provider, similarity);
|
positionOffsetGap, ignoreAbove, provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -189,18 +191,11 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
||||||
|
|
||||||
private int ignoreAbove;
|
private int ignoreAbove;
|
||||||
|
|
||||||
protected StringFieldMapper(Names names, float boost, FieldType fieldType,
|
|
||||||
String nullValue, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
|
||||||
PostingsFormatProvider postingsFormat, SimilarityProvider similarity) {
|
|
||||||
this(names, boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, searchAnalyzer,
|
|
||||||
Defaults.POSITION_OFFSET_GAP, Defaults.IGNORE_ABOVE, postingsFormat, similarity);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected StringFieldMapper(Names names, float boost, FieldType fieldType,
|
protected StringFieldMapper(Names names, float boost, FieldType fieldType,
|
||||||
String nullValue, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
String nullValue, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
||||||
NamedAnalyzer searchQuotedAnalyzer, int positionOffsetGap, int ignoreAbove,
|
NamedAnalyzer searchQuotedAnalyzer, int positionOffsetGap, int ignoreAbove,
|
||||||
PostingsFormatProvider postingsFormat, SimilarityProvider similarity) {
|
PostingsFormatProvider postingsFormat, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, boost, fieldType, indexAnalyzer, searchAnalyzer, postingsFormat, similarity);
|
super(names, boost, fieldType, indexAnalyzer, searchAnalyzer, postingsFormat, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
this.positionOffsetGap = positionOffsetGap;
|
this.positionOffsetGap = positionOffsetGap;
|
||||||
this.searchQuotedAnalyzer = searchQuotedAnalyzer != null ? searchQuotedAnalyzer : this.searchAnalyzer;
|
this.searchQuotedAnalyzer = searchQuotedAnalyzer != null ? searchQuotedAnalyzer : this.searchAnalyzer;
|
||||||
|
@ -213,7 +208,7 @@ public class StringFieldMapper extends AbstractFieldMapper<String> implements Al
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,8 @@ public class TypeParsers {
|
||||||
builder.postingsFormat(parserContext.postingFormatService().get(postingFormatName));
|
builder.postingsFormat(parserContext.postingFormatService().get(postingFormatName));
|
||||||
} else if (propName.equals("similarity")) {
|
} else if (propName.equals("similarity")) {
|
||||||
builder.similarity(parserContext.similarityLookupService().similarity(propNode.toString()));
|
builder.similarity(parserContext.similarityLookupService().similarity(propNode.toString()));
|
||||||
|
} else if (propName.equals("fielddata")) {
|
||||||
|
builder.fieldDataSettings(propNode.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,15 +22,18 @@ package org.elasticsearch.index.mapper.geo;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.geo.GeoHashUtils;
|
import org.elasticsearch.common.geo.GeoHashUtils;
|
||||||
import org.elasticsearch.common.geo.GeoPoint;
|
import org.elasticsearch.common.geo.GeoPoint;
|
||||||
import org.elasticsearch.common.geo.GeoUtils;
|
import org.elasticsearch.common.geo.GeoUtils;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
import org.elasticsearch.common.xcontent.support.XContentMapValues;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
||||||
import org.elasticsearch.index.mapper.core.DoubleFieldMapper;
|
import org.elasticsearch.index.mapper.core.DoubleFieldMapper;
|
||||||
|
@ -559,7 +562,7 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser {
|
||||||
@Override
|
@Override
|
||||||
public GeoStringFieldMapper build(BuilderContext context) {
|
public GeoStringFieldMapper build(BuilderContext context) {
|
||||||
GeoStringFieldMapper fieldMapper = new GeoStringFieldMapper(buildNames(context),
|
GeoStringFieldMapper fieldMapper = new GeoStringFieldMapper(buildNames(context),
|
||||||
boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, provider);
|
boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, provider, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -569,8 +572,9 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser {
|
||||||
|
|
||||||
public GeoStringFieldMapper(Names names, float boost, FieldType fieldType, String nullValue,
|
public GeoStringFieldMapper(Names names, float boost, FieldType fieldType, String nullValue,
|
||||||
NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
||||||
PostingsFormatProvider provider) {
|
PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, provider, null);
|
super(names, boost, fieldType, nullValue, indexAnalyzer, searchAnalyzer, searchAnalyzer, Defaults.POSITION_OFFSET_GAP, Defaults.IGNORE_ABOVE,
|
||||||
|
provider, null, fieldDataSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -579,8 +583,8 @@ public class GeoPointFieldMapper implements Mapper, ArrayValueMapperParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new org.elasticsearch.index.fielddata.FieldDataType("geo_point");
|
return new FieldDataType("geo_point");
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeoPointFieldMapper geoMapper() {
|
public GeoPointFieldMapper geoMapper() {
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper<String> {
|
||||||
|
|
||||||
public GeoShapeFieldMapper(FieldMapper.Names names, SpatialPrefixTree prefixTree, double distanceErrorPct,
|
public GeoShapeFieldMapper(FieldMapper.Names names, SpatialPrefixTree prefixTree, double distanceErrorPct,
|
||||||
FieldType fieldType, PostingsFormatProvider provider) {
|
FieldType fieldType, PostingsFormatProvider provider) {
|
||||||
super(names, 1, fieldType, null, null, provider, null);
|
super(names, 1, fieldType, null, null, provider, null, null);
|
||||||
this.spatialStrategy = new TermQueryPrefixTreeStrategy(names, prefixTree, distanceErrorPct);
|
this.spatialStrategy = new TermQueryPrefixTreeStrategy(names, prefixTree, distanceErrorPct);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,8 +149,8 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
throw new ElasticSearchIllegalArgumentException("field data on geo_shape field is not supported");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,14 +26,16 @@ import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||||
import org.apache.lucene.index.Term;
|
import org.apache.lucene.index.Term;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.search.TermQuery;
|
import org.apache.lucene.search.TermQuery;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.all.AllField;
|
import org.elasticsearch.common.lucene.all.AllField;
|
||||||
import org.elasticsearch.common.lucene.all.AllTermQuery;
|
import org.elasticsearch.common.lucene.all.AllTermQuery;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
import org.elasticsearch.index.mapper.core.AbstractFieldMapper;
|
||||||
import org.elasticsearch.index.query.QueryParseContext;
|
import org.elasticsearch.index.query.QueryParseContext;
|
||||||
|
@ -100,7 +102,7 @@ public class AllFieldMapper extends AbstractFieldMapper<Void> implements Interna
|
||||||
fieldType.setIndexed(true);
|
fieldType.setIndexed(true);
|
||||||
fieldType.setTokenized(true);
|
fieldType.setTokenized(true);
|
||||||
|
|
||||||
return new AllFieldMapper(name, fieldType, indexAnalyzer, searchAnalyzer, enabled, autoBoost, provider, similarity);
|
return new AllFieldMapper(name, fieldType, indexAnalyzer, searchAnalyzer, enabled, autoBoost, provider, similarity, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,12 +134,12 @@ public class AllFieldMapper extends AbstractFieldMapper<Void> implements Interna
|
||||||
private volatile boolean autoBoost;
|
private volatile boolean autoBoost;
|
||||||
|
|
||||||
public AllFieldMapper() {
|
public AllFieldMapper() {
|
||||||
this(Defaults.NAME, new FieldType(Defaults.FIELD_TYPE), null, null, Defaults.ENABLED, false, null, null);
|
this(Defaults.NAME, new FieldType(Defaults.FIELD_TYPE), null, null, Defaults.ENABLED, false, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AllFieldMapper(String name, FieldType fieldType, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
protected AllFieldMapper(String name, FieldType fieldType, NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
|
||||||
boolean enabled, boolean autoBoost, PostingsFormatProvider provider, SimilarityProvider similarity) {
|
boolean enabled, boolean autoBoost, PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(name, name, name, name), 1.0f, fieldType, indexAnalyzer, searchAnalyzer, provider, similarity);
|
super(new Names(name, name, name, name), 1.0f, fieldType, indexAnalyzer, searchAnalyzer, provider, similarity, fieldDataSettings);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.autoBoost = autoBoost;
|
this.autoBoost = autoBoost;
|
||||||
|
|
||||||
|
@ -153,8 +155,8 @@ public class AllFieldMapper extends AbstractFieldMapper<Void> implements Interna
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
throw new ElasticSearchIllegalArgumentException("using field data on _all field is not supported");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,10 +27,10 @@ import org.apache.lucene.search.NumericRangeQuery;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.NumericUtils;
|
import org.apache.lucene.util.NumericUtils;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
|
@ -88,7 +88,7 @@ public class BoostFieldMapper extends NumberFieldMapper<Float> implements Intern
|
||||||
@Override
|
@Override
|
||||||
public BoostFieldMapper build(BuilderContext context) {
|
public BoostFieldMapper build(BuilderContext context) {
|
||||||
return new BoostFieldMapper(name, buildIndexName(context),
|
return new BoostFieldMapper(name, buildIndexName(context),
|
||||||
precisionStep, boost, fieldType, nullValue, provider);
|
precisionStep, boost, fieldType, nullValue, provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,14 +117,14 @@ public class BoostFieldMapper extends NumberFieldMapper<Float> implements Intern
|
||||||
|
|
||||||
protected BoostFieldMapper(String name, String indexName) {
|
protected BoostFieldMapper(String name, String indexName) {
|
||||||
this(name, indexName, Defaults.PRECISION_STEP, Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
this(name, indexName, Defaults.PRECISION_STEP, Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
||||||
Defaults.NULL_VALUE, null);
|
Defaults.NULL_VALUE, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected BoostFieldMapper(String name, String indexName, int precisionStep, float boost, FieldType fieldType,
|
protected BoostFieldMapper(String name, String indexName, int precisionStep, float boost, FieldType fieldType,
|
||||||
Float nullValue, PostingsFormatProvider provider) {
|
Float nullValue, PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(name, indexName, indexName, name), precisionStep, null, boost, fieldType,
|
super(new Names(name, indexName, indexName, name), precisionStep, null, boost, fieldType,
|
||||||
Defaults.IGNORE_MALFORMED, new NamedAnalyzer("_float/" + precisionStep, new NumericFloatAnalyzer(precisionStep)),
|
Defaults.IGNORE_MALFORMED, new NamedAnalyzer("_float/" + precisionStep, new NumericFloatAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_float/max", new NumericFloatAnalyzer(Integer.MAX_VALUE)), provider, null);
|
new NamedAnalyzer("_float/max", new NumericFloatAnalyzer(Integer.MAX_VALUE)), provider, null, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,8 +134,8 @@ public class BoostFieldMapper extends NumberFieldMapper<Float> implements Intern
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
return new FieldDataType("float");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,6 +33,7 @@ import org.elasticsearch.common.lucene.BytesRefs;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.search.RegexpFilter;
|
import org.elasticsearch.common.lucene.search.RegexpFilter;
|
||||||
import org.elasticsearch.common.lucene.search.XBooleanFilter;
|
import org.elasticsearch.common.lucene.search.XBooleanFilter;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
@ -93,7 +94,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IdFieldMapper build(BuilderContext context) {
|
public IdFieldMapper build(BuilderContext context) {
|
||||||
return new IdFieldMapper(name, indexName, boost, fieldType, path, provider);
|
return new IdFieldMapper(name, indexName, boost, fieldType, path, provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +125,13 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IdFieldMapper(String name, String indexName, FieldType fieldType) {
|
protected IdFieldMapper(String name, String indexName, FieldType fieldType) {
|
||||||
this(name, indexName, Defaults.BOOST, fieldType, Defaults.PATH, null);
|
this(name, indexName, Defaults.BOOST, fieldType, Defaults.PATH, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IdFieldMapper(String name, String indexName, float boost, FieldType fieldType, String path,
|
protected IdFieldMapper(String name, String indexName, float boost, FieldType fieldType, String path,
|
||||||
PostingsFormatProvider provider) {
|
PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(name, indexName, indexName, name), boost, fieldType, Lucene.KEYWORD_ANALYZER,
|
super(new Names(name, indexName, indexName, name), boost, fieldType, Lucene.KEYWORD_ANALYZER,
|
||||||
Lucene.KEYWORD_ANALYZER, provider, null);
|
Lucene.KEYWORD_ANALYZER, provider, null, fieldDataSettings);
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ public class IdFieldMapper extends AbstractFieldMapper<String> implements Intern
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,10 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
|
@ -80,7 +82,7 @@ public class IndexFieldMapper extends AbstractFieldMapper<String> implements Int
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IndexFieldMapper build(BuilderContext context) {
|
public IndexFieldMapper build(BuilderContext context) {
|
||||||
return new IndexFieldMapper(name, indexName, boost, fieldType, enabled, provider);
|
return new IndexFieldMapper(name, indexName, boost, fieldType, enabled, provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,13 +110,13 @@ public class IndexFieldMapper extends AbstractFieldMapper<String> implements Int
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IndexFieldMapper(String name, String indexName) {
|
protected IndexFieldMapper(String name, String indexName) {
|
||||||
this(name, indexName, Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE), Defaults.ENABLED, null);
|
this(name, indexName, Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE), Defaults.ENABLED, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexFieldMapper(String name, String indexName, float boost, FieldType fieldType, boolean enabled,
|
public IndexFieldMapper(String name, String indexName, float boost, FieldType fieldType, boolean enabled,
|
||||||
PostingsFormatProvider provider) {
|
PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(name, indexName, indexName, name), boost, fieldType, Lucene.KEYWORD_ANALYZER,
|
super(new Names(name, indexName, indexName, name), boost, fieldType, Lucene.KEYWORD_ANALYZER,
|
||||||
Lucene.KEYWORD_ANALYZER, provider, null);
|
Lucene.KEYWORD_ANALYZER, provider, null, fieldDataSettings);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ public class IndexFieldMapper extends AbstractFieldMapper<String> implements Int
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.lucene.BytesRefs;
|
import org.elasticsearch.common.lucene.BytesRefs;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.search.XTermsFilter;
|
import org.elasticsearch.common.lucene.search.XTermsFilter;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
|
@ -94,7 +95,7 @@ public class ParentFieldMapper extends AbstractFieldMapper<Uid> implements Inter
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new MapperParsingException("Parent mapping must contain the parent type");
|
throw new MapperParsingException("Parent mapping must contain the parent type");
|
||||||
}
|
}
|
||||||
return new ParentFieldMapper(name, indexName, type, postingsFormat);
|
return new ParentFieldMapper(name, indexName, type, postingsFormat, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,9 +120,9 @@ public class ParentFieldMapper extends AbstractFieldMapper<Uid> implements Inter
|
||||||
private final String type;
|
private final String type;
|
||||||
private final BytesRef typeAsBytes;
|
private final BytesRef typeAsBytes;
|
||||||
|
|
||||||
protected ParentFieldMapper(String name, String indexName, String type, PostingsFormatProvider postingsFormat) {
|
protected ParentFieldMapper(String name, String indexName, String type, PostingsFormatProvider postingsFormat, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(name, indexName, indexName, name), Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
super(new Names(name, indexName, indexName, name), Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
||||||
Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, postingsFormat, null);
|
Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, postingsFormat, null, fieldDataSettings);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.typeAsBytes = new BytesRef(type);
|
this.typeAsBytes = new BytesRef(type);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ public class ParentFieldMapper extends AbstractFieldMapper<Uid> implements Inter
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,10 @@ import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
|
@ -87,7 +89,7 @@ public class RoutingFieldMapper extends AbstractFieldMapper<String> implements I
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RoutingFieldMapper build(BuilderContext context) {
|
public RoutingFieldMapper build(BuilderContext context) {
|
||||||
return new RoutingFieldMapper(fieldType, required, path, provider);
|
return new RoutingFieldMapper(fieldType, required, path, provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,12 +117,12 @@ public class RoutingFieldMapper extends AbstractFieldMapper<String> implements I
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|
||||||
public RoutingFieldMapper() {
|
public RoutingFieldMapper() {
|
||||||
this(new FieldType(Defaults.FIELD_TYPE), Defaults.REQUIRED, Defaults.PATH, null);
|
this(new FieldType(Defaults.FIELD_TYPE), Defaults.REQUIRED, Defaults.PATH, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RoutingFieldMapper(FieldType fieldType, boolean required, String path, PostingsFormatProvider provider) {
|
protected RoutingFieldMapper(FieldType fieldType, boolean required, String path, PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(Defaults.NAME, Defaults.NAME, Defaults.NAME, Defaults.NAME), 1.0f, fieldType, Lucene.KEYWORD_ANALYZER,
|
super(new Names(Defaults.NAME, Defaults.NAME, Defaults.NAME, Defaults.NAME), 1.0f, fieldType, Lucene.KEYWORD_ANALYZER,
|
||||||
Lucene.KEYWORD_ANALYZER, provider, null);
|
Lucene.KEYWORD_ANALYZER, provider, null, fieldDataSettings);
|
||||||
this.required = required;
|
this.required = required;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +133,7 @@ public class RoutingFieldMapper extends AbstractFieldMapper<String> implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,9 @@ package org.elasticsearch.index.mapper.internal;
|
||||||
|
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
|
@ -71,7 +73,7 @@ public class SizeFieldMapper extends IntegerFieldMapper implements RootMapper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SizeFieldMapper build(BuilderContext context) {
|
public SizeFieldMapper build(BuilderContext context) {
|
||||||
return new SizeFieldMapper(enabled, fieldType, provider);
|
return new SizeFieldMapper(enabled, fieldType, provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,12 +97,12 @@ public class SizeFieldMapper extends IntegerFieldMapper implements RootMapper {
|
||||||
private final boolean enabled;
|
private final boolean enabled;
|
||||||
|
|
||||||
public SizeFieldMapper() {
|
public SizeFieldMapper() {
|
||||||
this(Defaults.ENABLED, new FieldType(Defaults.SIZE_FIELD_TYPE), null);
|
this(Defaults.ENABLED, new FieldType(Defaults.SIZE_FIELD_TYPE), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SizeFieldMapper(boolean enabled, FieldType fieldType, PostingsFormatProvider provider) {
|
public SizeFieldMapper(boolean enabled, FieldType fieldType, PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(Defaults.NAME), Defaults.PRECISION_STEP, Defaults.FUZZY_FACTOR,
|
super(new Names(Defaults.NAME), Defaults.PRECISION_STEP, Defaults.FUZZY_FACTOR,
|
||||||
Defaults.BOOST, fieldType, Defaults.NULL_VALUE, Defaults.IGNORE_MALFORMED, provider, null);
|
Defaults.BOOST, fieldType, Defaults.NULL_VALUE, Defaults.IGNORE_MALFORMED, provider, null, fieldDataSettings);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.lucene.document.FieldType;
|
||||||
import org.apache.lucene.document.StoredField;
|
import org.apache.lucene.document.StoredField;
|
||||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.elasticsearch.ElasticSearchIllegalArgumentException;
|
|
||||||
import org.elasticsearch.ElasticSearchParseException;
|
import org.elasticsearch.ElasticSearchParseException;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.bytes.BytesArray;
|
import org.elasticsearch.common.bytes.BytesArray;
|
||||||
|
@ -201,7 +200,7 @@ public class SourceFieldMapper extends AbstractFieldMapper<byte[]> implements In
|
||||||
protected SourceFieldMapper(String name, boolean enabled, String format, Boolean compress, long compressThreshold,
|
protected SourceFieldMapper(String name, boolean enabled, String format, Boolean compress, long compressThreshold,
|
||||||
String[] includes, String[] excludes) {
|
String[] includes, String[] excludes) {
|
||||||
super(new Names(name, name, name, name), Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
super(new Names(name, name, name, name), Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
||||||
Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, null, null); // Only stored.
|
Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, null, null, null); // Only stored.
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.compress = compress;
|
this.compress = compress;
|
||||||
this.compressThreshold = compressThreshold;
|
this.compressThreshold = compressThreshold;
|
||||||
|
@ -221,8 +220,8 @@ public class SourceFieldMapper extends AbstractFieldMapper<byte[]> implements In
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
throw new ElasticSearchIllegalArgumentException("field data on _source field is not supported");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,7 +22,9 @@ package org.elasticsearch.index.mapper.internal;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
import org.elasticsearch.common.Explicit;
|
import org.elasticsearch.common.Explicit;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
|
@ -83,7 +85,7 @@ public class TTLFieldMapper extends LongFieldMapper implements InternalMapper, R
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TTLFieldMapper build(BuilderContext context) {
|
public TTLFieldMapper build(BuilderContext context) {
|
||||||
return new TTLFieldMapper(fieldType, enabled, defaultTTL, ignoreMalformed(context), provider);
|
return new TTLFieldMapper(fieldType, enabled, defaultTTL, ignoreMalformed(context), provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,14 +114,14 @@ public class TTLFieldMapper extends LongFieldMapper implements InternalMapper, R
|
||||||
private long defaultTTL;
|
private long defaultTTL;
|
||||||
|
|
||||||
public TTLFieldMapper() {
|
public TTLFieldMapper() {
|
||||||
this(new FieldType(Defaults.TTL_FIELD_TYPE), Defaults.ENABLED, Defaults.DEFAULT, Defaults.IGNORE_MALFORMED, null);
|
this(new FieldType(Defaults.TTL_FIELD_TYPE), Defaults.ENABLED, Defaults.DEFAULT, Defaults.IGNORE_MALFORMED, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TTLFieldMapper(FieldType fieldType, boolean enabled, long defaultTTL, Explicit<Boolean> ignoreMalformed,
|
protected TTLFieldMapper(FieldType fieldType, boolean enabled, long defaultTTL, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider) {
|
PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(Defaults.NAME, Defaults.NAME, Defaults.NAME, Defaults.NAME), Defaults.PRECISION_STEP,
|
super(new Names(Defaults.NAME, Defaults.NAME, Defaults.NAME, Defaults.NAME), Defaults.PRECISION_STEP,
|
||||||
Defaults.FUZZY_FACTOR, Defaults.BOOST, fieldType, Defaults.NULL_VALUE, ignoreMalformed,
|
Defaults.FUZZY_FACTOR, Defaults.BOOST, fieldType, Defaults.NULL_VALUE, ignoreMalformed,
|
||||||
provider, null);
|
provider, null, fieldDataSettings);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.defaultTTL = defaultTTL;
|
this.defaultTTL = defaultTTL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,11 @@ package org.elasticsearch.index.mapper.internal;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.FieldType;
|
import org.apache.lucene.document.FieldType;
|
||||||
import org.elasticsearch.common.Explicit;
|
import org.elasticsearch.common.Explicit;
|
||||||
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
import org.elasticsearch.common.joda.FormatDateTimeFormatter;
|
||||||
import org.elasticsearch.common.joda.Joda;
|
import org.elasticsearch.common.joda.Joda;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
|
@ -98,7 +100,7 @@ public class TimestampFieldMapper extends DateFieldMapper implements InternalMap
|
||||||
parseUpperInclusive = context.indexSettings().getAsBoolean("index.mapping.date.parse_upper_inclusive", Defaults.PARSE_UPPER_INCLUSIVE);
|
parseUpperInclusive = context.indexSettings().getAsBoolean("index.mapping.date.parse_upper_inclusive", Defaults.PARSE_UPPER_INCLUSIVE);
|
||||||
}
|
}
|
||||||
return new TimestampFieldMapper(fieldType, enabled, path, dateTimeFormatter, parseUpperInclusive,
|
return new TimestampFieldMapper(fieldType, enabled, path, dateTimeFormatter, parseUpperInclusive,
|
||||||
ignoreMalformed(context), provider);
|
ignoreMalformed(context), provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,16 +131,16 @@ public class TimestampFieldMapper extends DateFieldMapper implements InternalMap
|
||||||
|
|
||||||
public TimestampFieldMapper() {
|
public TimestampFieldMapper() {
|
||||||
this(new FieldType(Defaults.FIELD_TYPE), Defaults.ENABLED, Defaults.PATH, Defaults.DATE_TIME_FORMATTER,
|
this(new FieldType(Defaults.FIELD_TYPE), Defaults.ENABLED, Defaults.PATH, Defaults.DATE_TIME_FORMATTER,
|
||||||
Defaults.PARSE_UPPER_INCLUSIVE, Defaults.IGNORE_MALFORMED, null);
|
Defaults.PARSE_UPPER_INCLUSIVE, Defaults.IGNORE_MALFORMED, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TimestampFieldMapper(FieldType fieldType, boolean enabled, String path,
|
protected TimestampFieldMapper(FieldType fieldType, boolean enabled, String path,
|
||||||
FormatDateTimeFormatter dateTimeFormatter, boolean parseUpperInclusive,
|
FormatDateTimeFormatter dateTimeFormatter, boolean parseUpperInclusive,
|
||||||
Explicit<Boolean> ignoreMalformed, PostingsFormatProvider provider) {
|
Explicit<Boolean> ignoreMalformed, PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(Defaults.NAME, Defaults.NAME, Defaults.NAME, Defaults.NAME), dateTimeFormatter,
|
super(new Names(Defaults.NAME, Defaults.NAME, Defaults.NAME, Defaults.NAME), dateTimeFormatter,
|
||||||
Defaults.PRECISION_STEP, Defaults.FUZZY_FACTOR, Defaults.BOOST, fieldType,
|
Defaults.PRECISION_STEP, Defaults.FUZZY_FACTOR, Defaults.BOOST, fieldType,
|
||||||
Defaults.NULL_VALUE, TimeUnit.MILLISECONDS /*always milliseconds*/,
|
Defaults.NULL_VALUE, TimeUnit.MILLISECONDS /*always milliseconds*/,
|
||||||
parseUpperInclusive, ignoreMalformed, provider, null);
|
parseUpperInclusive, ignoreMalformed, provider, null, fieldDataSettings);
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.common.lucene.BytesRefs;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.search.TermFilter;
|
import org.elasticsearch.common.lucene.search.TermFilter;
|
||||||
import org.elasticsearch.common.lucene.search.XConstantScoreQuery;
|
import org.elasticsearch.common.lucene.search.XConstantScoreQuery;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
|
@ -78,7 +79,7 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TypeFieldMapper build(BuilderContext context) {
|
public TypeFieldMapper build(BuilderContext context) {
|
||||||
return new TypeFieldMapper(name, indexName, boost, fieldType, provider);
|
return new TypeFieldMapper(name, indexName, boost, fieldType, provider, fieldDataSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,12 +98,12 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TypeFieldMapper(String name, String indexName) {
|
protected TypeFieldMapper(String name, String indexName) {
|
||||||
this(name, indexName, Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE), null);
|
this(name, indexName, Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TypeFieldMapper(String name, String indexName, float boost, FieldType fieldType, PostingsFormatProvider provider) {
|
public TypeFieldMapper(String name, String indexName, float boost, FieldType fieldType, PostingsFormatProvider provider, @Nullable Settings fieldDataSettings) {
|
||||||
super(new Names(name, indexName, indexName, name), boost, fieldType, Lucene.KEYWORD_ANALYZER,
|
super(new Names(name, indexName, indexName, name), boost, fieldType, Lucene.KEYWORD_ANALYZER,
|
||||||
Lucene.KEYWORD_ANALYZER, provider, null);
|
Lucene.KEYWORD_ANALYZER, provider, null, fieldDataSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,7 +112,7 @@ public class TypeFieldMapper extends AbstractFieldMapper<String> implements Inte
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string");
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.lucene.index.Term;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
import org.elasticsearch.common.lucene.Lucene;
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
import org.elasticsearch.common.lucene.uid.UidField;
|
import org.elasticsearch.common.lucene.uid.UidField;
|
||||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
|
@ -120,7 +119,7 @@ public class UidFieldMapper extends AbstractFieldMapper<Uid> implements Internal
|
||||||
|
|
||||||
protected UidFieldMapper(String name, String indexName, PostingsFormatProvider postingsFormat) {
|
protected UidFieldMapper(String name, String indexName, PostingsFormatProvider postingsFormat) {
|
||||||
super(new Names(name, indexName, indexName, name), Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
super(new Names(name, indexName, indexName, name), Defaults.BOOST, new FieldType(Defaults.FIELD_TYPE),
|
||||||
Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, postingsFormat, null);
|
Lucene.KEYWORD_ANALYZER, Lucene.KEYWORD_ANALYZER, postingsFormat, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -129,8 +128,8 @@ public class UidFieldMapper extends AbstractFieldMapper<Uid> implements Internal
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new FieldDataType("string", ImmutableSettings.builder().put("format", "paged_bytes"));
|
return new FieldDataType("string");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,12 +30,14 @@ import org.elasticsearch.common.Explicit;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
import org.elasticsearch.common.Numbers;
|
import org.elasticsearch.common.Numbers;
|
||||||
import org.elasticsearch.common.Strings;
|
import org.elasticsearch.common.Strings;
|
||||||
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import org.elasticsearch.common.xcontent.XContentParser;
|
import org.elasticsearch.common.xcontent.XContentParser;
|
||||||
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
import org.elasticsearch.index.analysis.NamedAnalyzer;
|
||||||
import org.elasticsearch.index.analysis.NumericAnalyzer;
|
import org.elasticsearch.index.analysis.NumericAnalyzer;
|
||||||
import org.elasticsearch.index.analysis.NumericTokenizer;
|
import org.elasticsearch.index.analysis.NumericTokenizer;
|
||||||
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider;
|
||||||
|
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||||
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
||||||
import org.elasticsearch.index.mapper.*;
|
import org.elasticsearch.index.mapper.*;
|
||||||
|
@ -114,7 +116,7 @@ public class IpFieldMapper extends NumberFieldMapper<Long> {
|
||||||
public IpFieldMapper build(BuilderContext context) {
|
public IpFieldMapper build(BuilderContext context) {
|
||||||
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
fieldType.setOmitNorms(fieldType.omitNorms() && boost == 1.0f);
|
||||||
IpFieldMapper fieldMapper = new IpFieldMapper(buildNames(context),
|
IpFieldMapper fieldMapper = new IpFieldMapper(buildNames(context),
|
||||||
precisionStep, boost, fieldType, nullValue, ignoreMalformed(context), provider, similarity);
|
precisionStep, boost, fieldType, nullValue, ignoreMalformed(context), provider, similarity, fieldDataSettings);
|
||||||
fieldMapper.includeInAll(includeInAll);
|
fieldMapper.includeInAll(includeInAll);
|
||||||
return fieldMapper;
|
return fieldMapper;
|
||||||
}
|
}
|
||||||
|
@ -141,10 +143,10 @@ public class IpFieldMapper extends NumberFieldMapper<Long> {
|
||||||
protected IpFieldMapper(Names names, int precisionStep,
|
protected IpFieldMapper(Names names, int precisionStep,
|
||||||
float boost, FieldType fieldType,
|
float boost, FieldType fieldType,
|
||||||
String nullValue, Explicit<Boolean> ignoreMalformed,
|
String nullValue, Explicit<Boolean> ignoreMalformed,
|
||||||
PostingsFormatProvider provider, SimilarityProvider similarity) {
|
PostingsFormatProvider provider, SimilarityProvider similarity, @Nullable Settings fieldDataSettings) {
|
||||||
super(names, precisionStep, null, boost, fieldType,
|
super(names, precisionStep, null, boost, fieldType,
|
||||||
ignoreMalformed, new NamedAnalyzer("_ip/" + precisionStep, new NumericIpAnalyzer(precisionStep)),
|
ignoreMalformed, new NamedAnalyzer("_ip/" + precisionStep, new NumericIpAnalyzer(precisionStep)),
|
||||||
new NamedAnalyzer("_ip/max", new NumericIpAnalyzer(Integer.MAX_VALUE)), provider, similarity);
|
new NamedAnalyzer("_ip/max", new NumericIpAnalyzer(Integer.MAX_VALUE)), provider, similarity, fieldDataSettings);
|
||||||
this.nullValue = nullValue;
|
this.nullValue = nullValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,8 +156,8 @@ public class IpFieldMapper extends NumberFieldMapper<Long> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType() {
|
public FieldDataType defaultFieldDataType() {
|
||||||
return new org.elasticsearch.index.fielddata.FieldDataType("long");
|
return new FieldDataType("long");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue