add initial field data type support to mappers
hardwired and still happily leaves with current field data impl
This commit is contained in:
parent
e0b280f9b3
commit
2d91939253
|
@ -201,5 +201,7 @@ public interface FieldMapper<T> {
|
|||
|
||||
FieldDataType fieldDataType();
|
||||
|
||||
org.elasticsearch.index.fielddata.FieldDataType fieldDataType2();
|
||||
|
||||
PostingsFormatProvider postingsFormatProvider();
|
||||
}
|
||||
|
|
|
@ -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<BytesReference> {
|
|||
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);
|
||||
|
|
|
@ -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<Boolean> {
|
|||
return Defaults.FIELD_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useTermQueryWithQueryString() {
|
||||
return true;
|
||||
|
|
|
@ -128,6 +128,11 @@ public class ByteFieldMapper extends NumberFieldMapper<Byte> {
|
|||
return Defaults.FIELD_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int maxPrecisionStep() {
|
||||
return 32;
|
||||
|
|
|
@ -402,6 +402,11 @@ public class DateFieldMapper extends NumberFieldMapper<Long> {
|
|||
return FieldDataType.DefaultTypes.LONG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String contentType() {
|
||||
return CONTENT_TYPE;
|
||||
|
|
|
@ -131,6 +131,11 @@ public class DoubleFieldMapper extends NumberFieldMapper<Double> {
|
|||
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;
|
||||
|
|
|
@ -129,6 +129,11 @@ public class FloatFieldMapper extends NumberFieldMapper<Float> {
|
|||
return Defaults.FIELD_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int maxPrecisionStep() {
|
||||
return 32;
|
||||
|
|
|
@ -131,6 +131,11 @@ public class IntegerFieldMapper extends NumberFieldMapper<Integer> {
|
|||
return Defaults.FIELD_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int maxPrecisionStep() {
|
||||
return 32;
|
||||
|
|
|
@ -131,6 +131,11 @@ public class LongFieldMapper extends NumberFieldMapper<Long> {
|
|||
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;
|
||||
|
|
|
@ -131,6 +131,11 @@ public class ShortFieldMapper extends NumberFieldMapper<Short> {
|
|||
return Defaults.FIELD_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
throw new ElasticSearchIllegalArgumentException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int maxPrecisionStep() {
|
||||
return 32;
|
||||
|
|
|
@ -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<String> 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) {
|
||||
|
|
|
@ -147,6 +147,11 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper<String> {
|
|||
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()));
|
||||
|
|
|
@ -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<Void> 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) {
|
||||
|
|
|
@ -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<Float> 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;
|
||||
|
|
|
@ -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<String> 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) {
|
||||
|
|
|
@ -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<String> 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);
|
||||
|
|
|
@ -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<Uid> 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 {
|
||||
}
|
||||
|
|
|
@ -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<String> implements I
|
|||
return Defaults.FIELD_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.elasticsearch.index.fielddata.FieldDataType fieldDataType2() {
|
||||
return new FieldDataType("string");
|
||||
}
|
||||
|
||||
public void markAsRequired() {
|
||||
this.required = true;
|
||||
}
|
||||
|
|
|
@ -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<byte[]> 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);
|
||||
|
|
|
@ -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<String> 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) {
|
||||
|
|
|
@ -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<Uid> 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";
|
||||
|
|
|
@ -153,6 +153,11 @@ public class IpFieldMapper extends NumberFieldMapper<Long> {
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue