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 4d066e64ad2..7721a329557 100644 --- a/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/geo/GeoShapeFieldMapper.java @@ -5,13 +5,14 @@ import com.spatial4j.core.context.jts.JtsSpatialContext; import com.spatial4j.core.distance.DistanceUnits; import org.apache.lucene.document.Field; import org.apache.lucene.document.Fieldable; +import org.apache.lucene.index.FieldInfo; +import org.elasticsearch.ElasticSearchIllegalArgumentException; +import org.elasticsearch.common.Strings; +import org.elasticsearch.common.geo.GeoJSONShapeParser; import org.elasticsearch.common.lucene.spatial.SpatialStrategy; import org.elasticsearch.common.lucene.spatial.prefix.TermQueryPrefixTreeStrategy; import org.elasticsearch.common.lucene.spatial.prefix.tree.GeohashPrefixTree; import org.elasticsearch.common.lucene.spatial.prefix.tree.QuadPrefixTree; -import org.elasticsearch.ElasticSearchIllegalArgumentException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.geo.GeoJSONShapeParser; import org.elasticsearch.common.lucene.spatial.prefix.tree.SpatialPrefixTree; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.index.mapper.FieldMapper; @@ -25,18 +26,18 @@ import java.util.Map; /** * FieldMapper for indexing {@link com.spatial4j.core.shape.Shape}s. - * + *

* Currently Shapes can only be indexed and can only be queried using * {@link org.elasticsearch.index.query.GeoShapeFilterParser}, consequently * a lot of behavior in this Mapper is disabled. - * + *

* Format supported: - * + *

* "field" : { - * "type" : "polygon", - * "coordinates" : [ - * [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] - * ] + * "type" : "polygon", + * "coordinates" : [ + * [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] + * ] * } */ public class GeoShapeFieldMapper extends AbstractFieldMapper { @@ -128,7 +129,7 @@ public class GeoShapeFieldMapper extends AbstractFieldMapper { private final SpatialStrategy spatialStrategy; public GeoShapeFieldMapper(FieldMapper.Names names, SpatialPrefixTree prefixTree, double distanceErrorPct) { - super(names, Field.Index.NOT_ANALYZED, Field.Store.NO, Field.TermVector.NO, 1, true, true, null, null); + super(names, Field.Index.NOT_ANALYZED, Field.Store.NO, Field.TermVector.NO, 1, true, FieldInfo.IndexOptions.DOCS_ONLY, null, null); this.spatialStrategy = new TermQueryPrefixTreeStrategy(names, prefixTree, distanceErrorPct); } 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 abbd8213e04..fca40d673ae 100644 --- a/src/main/java/org/elasticsearch/index/mapper/internal/UidFieldMapper.java +++ b/src/main/java/org/elasticsearch/index/mapper/internal/UidFieldMapper.java @@ -21,6 +21,7 @@ package org.elasticsearch.index.mapper.internal; import org.apache.lucene.document.Field; import org.apache.lucene.document.Fieldable; +import org.apache.lucene.index.FieldInfo; import org.apache.lucene.index.Term; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.common.lucene.uid.UidField; @@ -48,6 +49,7 @@ public class UidFieldMapper extends AbstractFieldMapper implements Internal public static final String NAME = UidFieldMapper.NAME; public static final Field.Index INDEX = Field.Index.NOT_ANALYZED; public static final boolean OMIT_NORMS = true; + public static final FieldInfo.IndexOptions INDEX_OPTIONS = FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; // we store payload (otherwise, we really need just docs) } public static class Builder extends Mapper.Builder {