Class FieldMapper

java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<Mapper>, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment
Direct Known Subclasses:
AbstractGeometryFieldMapper, CompletionFieldMapper, DateFieldMapper, DynamicKeyFieldMapper, IpFieldMapper, KeywordFieldMapper, MetadataFieldMapper, NumberFieldMapper, ParametrizedFieldMapper, RangeFieldMapper, TextFieldMapper

public abstract class FieldMapper
extends Mapper
implements java.lang.Cloneable
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  FieldMapper.Builder<T extends FieldMapper.Builder<T>>  
    static class  FieldMapper.CopyTo
    Represents a list of fields with optional boost factor where the current field should be copied to
    static class  FieldMapper.MultiFields  

    Nested classes/interfaces inherited from class org.elasticsearch.index.mapper.Mapper

    Mapper.BuilderContext, Mapper.TypeParser

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static Setting<java.lang.Boolean> COERCE_SETTING  
    protected FieldMapper.CopyTo copyTo  
    protected org.apache.lucene.document.FieldType fieldType  
    static Setting<java.lang.Boolean> IGNORE_MALFORMED_SETTING  
    protected MappedFieldType mappedFieldType  
    protected FieldMapper.MultiFields multiFields  

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected FieldMapper​(java.lang.String simpleName, org.apache.lucene.document.FieldType fieldType, MappedFieldType mappedFieldType, FieldMapper.MultiFields multiFields, FieldMapper.CopyTo copyTo)  
  • Method Summary

    Modifier and Type Method Description
    protected FieldMapper clone()  
    protected abstract java.lang.String contentType()  
    FieldMapper.CopyTo copyTo()
    List of fields where this field should be copied to
    protected void createFieldNamesField​(ParseContext context)  
    protected boolean docValuesByDefault()  
    protected void doXContentAnalyzers​(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults)  
    protected void doXContentBody​(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    MappedFieldType fieldType()  
    protected boolean indexedByDefault()  
    protected static java.lang.String indexOptionToString​(org.apache.lucene.index.IndexOptions indexOption)  
    java.util.Iterator<Mapper> iterator()  
    FieldMapper merge​(Mapper mergeWith)
    Return the merge of mergeWith into this.
    protected abstract void mergeOptions​(FieldMapper other, java.util.List<java.lang.String> conflicts)
    Merge type-specific options and check for incompatible settings in mappings to be merged
    java.lang.String name()
    Returns the canonical name which uniquely identifies the mapper against other mappers in a type.
    void parse​(ParseContext context)
    Parse the field value using the provided ParseContext.
    protected abstract void parseCreateField​(ParseContext context)
    Parse the field value and populate the fields on ParseContext.doc().
    boolean parsesArrayValue()
    Whether this mapper can handle an array value during document parsing.
    protected boolean storedByDefault()  
    static java.lang.String termVectorOptionsToString​(org.apache.lucene.document.FieldType fieldType)  
    org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params)  
    java.lang.String typeName()
    Returns a name representing the type of this mapper.

    Methods inherited from class org.elasticsearch.index.mapper.Mapper

    simpleName

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentFragment

    isFragment
  • Field Details

  • Constructor Details

  • Method Details

    • name

      public java.lang.String name()
      Description copied from class: Mapper
      Returns the canonical name which uniquely identifies the mapper against other mappers in a type.
      Specified by:
      name in class Mapper
    • typeName

      public java.lang.String typeName()
      Description copied from class: Mapper
      Returns a name representing the type of this mapper.
      Specified by:
      typeName in class Mapper
    • fieldType

      public MappedFieldType fieldType()
    • copyTo

      public FieldMapper.CopyTo copyTo()
      List of fields where this field should be copied to
    • parsesArrayValue

      public boolean parsesArrayValue()
      Whether this mapper can handle an array value during document parsing. If true, when an array is encountered during parsing, the document parser will pass the whole array to the mapper. If false, the array is split into individual values and each value is passed to the mapper for parsing.
    • parse

      public void parse​(ParseContext context) throws java.io.IOException
      Parse the field value using the provided ParseContext.
      Throws:
      java.io.IOException
    • parseCreateField

      protected abstract void parseCreateField​(ParseContext context) throws java.io.IOException
      Parse the field value and populate the fields on ParseContext.doc(). Implementations of this method should ensure that on failing to parse parser.currentToken() must be the current failing token
      Throws:
      java.io.IOException
    • createFieldNamesField

      protected void createFieldNamesField​(ParseContext context)
    • iterator

      public java.util.Iterator<Mapper> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<Mapper>
    • clone

      protected FieldMapper clone()
      Overrides:
      clone in class java.lang.Object
    • merge

      public FieldMapper merge​(Mapper mergeWith)
      Description copied from class: Mapper
      Return the merge of mergeWith into this. Both this and mergeWith will be left unmodified.
      Specified by:
      merge in class Mapper
    • mergeOptions

      protected abstract void mergeOptions​(FieldMapper other, java.util.List<java.lang.String> conflicts)
      Merge type-specific options and check for incompatible settings in mappings to be merged
    • toXContent

      public org.elasticsearch.common.xcontent.XContentBuilder toXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Specified by:
      toXContent in interface org.elasticsearch.common.xcontent.ToXContent
      Throws:
      java.io.IOException
    • indexedByDefault

      protected boolean indexedByDefault()
    • docValuesByDefault

      protected boolean docValuesByDefault()
    • storedByDefault

      protected boolean storedByDefault()
    • doXContentBody

      protected void doXContentBody​(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults, org.elasticsearch.common.xcontent.ToXContent.Params params) throws java.io.IOException
      Throws:
      java.io.IOException
    • doXContentAnalyzers

      protected final void doXContentAnalyzers​(org.elasticsearch.common.xcontent.XContentBuilder builder, boolean includeDefaults) throws java.io.IOException
      Throws:
      java.io.IOException
    • indexOptionToString

      protected static java.lang.String indexOptionToString​(org.apache.lucene.index.IndexOptions indexOption)
    • termVectorOptionsToString

      public static java.lang.String termVectorOptionsToString​(org.apache.lucene.document.FieldType fieldType)
    • contentType

      protected abstract java.lang.String contentType()