java.lang.Object
org.elasticsearch.index.mapper.Mapper
All Implemented Interfaces:
Iterable<Mapper>, ToXContent, ToXContentFragment
Direct Known Subclasses:
FieldAliasMapper, FieldMapper, ObjectMapper

public abstract class Mapper extends Object implements ToXContentFragment, Iterable<Mapper>
  • Field Details

  • Constructor Details

    • Mapper

      public Mapper(String leafName)
  • Method Details

    • leafName

      public final String leafName()
      Returns the name of the field. When the field has a parent object, its leaf name won't include the entire path. When subobjects are disabled, its leaf name will be the same as fullPath() in practice, because its parent is the root.
    • fullPath

      public abstract String fullPath()
      Returns the canonical name which uniquely identifies the mapper against other mappers in a type.
    • typeName

      public abstract String typeName()
      Returns a name representing the type of this mapper.
    • merge

      public abstract Mapper merge(Mapper mergeWith, MapperMergeContext mapperMergeContext)
      Return the merge of mergeWith into this. Both this and mergeWith will be left unmodified.
    • validate

      public abstract void validate(MappingLookup mappers)
      Validate any cross-field references made by this mapper
      Parameters:
      mappers - a MappingLookup that can produce references to other mappers
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • internFieldName

      public static String internFieldName(String fieldName)
      Interns the given field name string through a StringLiteralDeduplicator.
      Parameters:
      fieldName - field name to intern
      Returns:
      interned field name string
    • freezeAndDeduplicateFieldType

      public static org.apache.lucene.document.FieldType freezeAndDeduplicateFieldType(org.apache.lucene.document.FieldType fieldType)
      Freezes the given FieldType instances and tries to deduplicate it as long as the field does not return a non-empty value for FieldType.getAttributes().
      Parameters:
      fieldType - field type to deduplicate
      Returns:
      deduplicated field type
    • getTotalFieldsCount

      public abstract int getTotalFieldsCount()
      The total number of fields as defined in the mapping. Defines how this mapper counts towards MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.