diff --git a/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java index 3898474f378..e0f95d57658 100644 --- a/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/FieldMapper.java @@ -201,5 +201,7 @@ public interface FieldMapper { FieldDataType fieldDataType(); + org.elasticsearch.index.fielddata.FieldDataType fieldDataType2(); + PostingsFormatProvider postingsFormatProvider(); } diff --git a/src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java index f8f2f996b3f..01dfcde665b 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/BinaryFieldMapper.java @@ -22,6 +22,7 @@ package org.elasticsearch.index.mapper.core; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.common.Base64; import org.elasticsearch.common.Strings; @@ -132,6 +133,11 @@ public class BinaryFieldMapper extends AbstractFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("field data on binary field is not supported"); + } + @Override public Object valueForSearch(Object value) { return value(value); diff --git a/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java index 37aac7933fb..729ddb3f794 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/BooleanFieldMapper.java @@ -23,6 +23,7 @@ import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; import org.apache.lucene.search.Filter; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Strings; import org.elasticsearch.common.lucene.Lucene; @@ -159,6 +160,11 @@ public class BooleanFieldMapper extends AbstractFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override public boolean useTermQueryWithQueryString() { return true; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/ByteFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/ByteFieldMapper.java index 3eadbd79883..e62fea95626 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/ByteFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/ByteFieldMapper.java @@ -128,6 +128,11 @@ public class ByteFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override protected int maxPrecisionStep() { return 32; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java index 9e5081720a8..70af9552234 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/DateFieldMapper.java @@ -402,6 +402,11 @@ public class DateFieldMapper extends NumberFieldMapper { return FieldDataType.DefaultTypes.LONG; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override protected String contentType() { return CONTENT_TYPE; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java index ad63da5e24c..3e7ff3c4649 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/DoubleFieldMapper.java @@ -131,6 +131,11 @@ public class DoubleFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new org.elasticsearch.index.fielddata.FieldDataType("double"); + } + @Override protected int maxPrecisionStep() { return 64; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java index 79f869f13ad..0b7148a5db5 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/FloatFieldMapper.java @@ -129,6 +129,11 @@ public class FloatFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override protected int maxPrecisionStep() { return 32; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/IntegerFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/IntegerFieldMapper.java index 69aaf18315d..39bf7acd986 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/IntegerFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/IntegerFieldMapper.java @@ -131,6 +131,11 @@ public class IntegerFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override protected int maxPrecisionStep() { return 32; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java index d9b50f8ea2d..1055acfc93c 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/LongFieldMapper.java @@ -131,6 +131,11 @@ public class LongFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new org.elasticsearch.index.fielddata.FieldDataType("long"); + } + @Override protected int maxPrecisionStep() { return 64; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java index 94378a47375..729aafc6894 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/ShortFieldMapper.java @@ -131,6 +131,11 @@ public class ShortFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override protected int maxPrecisionStep() { return 32; diff --git a/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java index b73bd997926..6e071572c82 100644 --- a/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/core/StringFieldMapper.java @@ -35,6 +35,7 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.index.analysis.NamedAnalyzer; import org.elasticsearch.index.analysis.NamedCustomAnalyzer; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.internal.AllFieldMapper; import org.elasticsearch.index.similarity.SimilarityProvider; @@ -211,6 +212,11 @@ public class StringFieldMapper extends AbstractFieldMapper implements Al return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + @Override public void includeInAll(Boolean includeInAll) { if (includeInAll != null) { diff --git a/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java index ab62fea7239..2d0b4e258bc 100644 --- a/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java @@ -147,6 +147,11 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("field data on geo_shape field is not supported"); + } + @Override protected Field parseCreateField(ParseContext context) throws IOException { return spatialStrategy.createField(GeoJSONShapeParser.parse(context.parser())); diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java index 9d67fbd48e7..d84d695de7c 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/AllFieldMapper.java @@ -26,6 +26,7 @@ import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.index.Term; import org.apache.lucene.search.Query; import org.apache.lucene.search.TermQuery; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.common.Strings; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.all.AllField; @@ -151,6 +152,11 @@ public class AllFieldMapper extends AbstractFieldMapper implements Interna return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("using field data on _all field is not supported"); + } + @Override public Query queryStringTermQuery(Term term) { if (!autoBoost) { diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/BoostFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/BoostFieldMapper.java index fb5919688a4..a5c21775663 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/BoostFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/BoostFieldMapper.java @@ -27,6 +27,7 @@ import org.apache.lucene.search.NumericRangeQuery; import org.apache.lucene.search.Query; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.NumericUtils; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Numbers; import org.elasticsearch.common.Strings; @@ -131,6 +132,11 @@ public class BoostFieldMapper extends NumberFieldMapper implements Intern return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("not implemented"); + } + @Override protected int maxPrecisionStep() { return 32; diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java index c346d53bc15..fe0cf421028 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/IdFieldMapper.java @@ -36,6 +36,7 @@ import org.elasticsearch.common.lucene.search.XBooleanFilter; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; import org.elasticsearch.index.query.QueryParseContext; @@ -142,6 +143,11 @@ public class IdFieldMapper extends AbstractFieldMapper implements Intern return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + @Override public String value(Object value) { if (value == null) { diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/IndexFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/IndexFieldMapper.java index e47dbc69127..d278fab1706 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/IndexFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/IndexFieldMapper.java @@ -27,6 +27,7 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; @@ -126,6 +127,11 @@ public class IndexFieldMapper extends AbstractFieldMapper implements Int return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + public String value(Document document) { Field field = (Field) document.getField(names.indexName()); return field == null ? null : value(field); diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java index 6f0cb9e1e43..9eb1f6d96de 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/ParentFieldMapper.java @@ -33,6 +33,7 @@ import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.search.XTermsFilter; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; import org.elasticsearch.index.query.QueryParseContext; @@ -134,6 +135,11 @@ public class ParentFieldMapper extends AbstractFieldMapper implements Inter return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + @Override public void preParse(ParseContext context) throws IOException { } diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java index 25397949353..c8b81540a6e 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/RoutingFieldMapper.java @@ -27,6 +27,7 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; import org.elasticsearch.index.mapper.core.NumberFieldMapper; @@ -129,6 +130,11 @@ public class RoutingFieldMapper extends AbstractFieldMapper implements I return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + public void markAsRequired() { this.required = true; } diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java index 21d7d1ae19c..704f9cb1797 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/SourceFieldMapper.java @@ -25,6 +25,7 @@ import org.apache.lucene.document.FieldType; import org.apache.lucene.document.StoredField; import org.apache.lucene.index.FieldInfo.IndexOptions; import org.apache.lucene.util.BytesRef; +import org.elasticsearch.ElasticSearchIllegalArgumentException; import org.elasticsearch.ElasticSearchParseException; import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesArray; @@ -218,6 +219,11 @@ public class SourceFieldMapper extends AbstractFieldMapper implements In return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + throw new ElasticSearchIllegalArgumentException("field data on _source field is not supported"); + } + @Override public void preParse(ParseContext context) throws IOException { super.parse(context); diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/TypeFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/TypeFieldMapper.java index 90a48cd28d8..77283d8a87d 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/TypeFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/TypeFieldMapper.java @@ -33,6 +33,7 @@ import org.elasticsearch.common.lucene.search.TermFilter; import org.elasticsearch.common.lucene.search.XConstantScoreQuery; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; import org.elasticsearch.index.query.QueryParseContext; @@ -109,6 +110,11 @@ public class TypeFieldMapper extends AbstractFieldMapper implements Inte return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + @Override public String value(Object value) { if (value == null) { diff --git a/src/main/java/org/elasticsearch/index/mapper/internal/UidFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/internal/UidFieldMapper.java index 09de0a8ef19..fe95914bb1b 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/UidFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/UidFieldMapper.java @@ -28,6 +28,7 @@ import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.uid.UidField; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.codec.postingsformat.PostingsFormatProvider; +import org.elasticsearch.index.fielddata.FieldDataType; import org.elasticsearch.index.mapper.*; import org.elasticsearch.index.mapper.core.AbstractFieldMapper; @@ -126,6 +127,11 @@ public class UidFieldMapper extends AbstractFieldMapper implements Internal return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new FieldDataType("string"); + } + @Override protected String defaultPostingFormat() { return "bloom_default"; diff --git a/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java b/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java index 44d0d5b7a7f..321991d1d78 100644 --- a/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/ip/IpFieldMapper.java @@ -153,6 +153,11 @@ public class IpFieldMapper extends NumberFieldMapper { return Defaults.FIELD_TYPE; } + @Override + public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() { + return new org.elasticsearch.index.fielddata.FieldDataType("long"); + } + @Override protected int maxPrecisionStep() { return 64;