Class Mapping

java.lang.Object
org.elasticsearch.index.mapper.Mapping
All Implemented Interfaces:
org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment

public final class Mapping extends Object implements org.elasticsearch.common.xcontent.ToXContentFragment
Wrapper around everything that defines a mapping, without references to utility classes like MapperService, ...
  • Field Details

    • EMPTY

      public static final Mapping EMPTY
  • Constructor Details

  • Method Details

    • toCompressedXContent

      public CompressedXContent toCompressedXContent()
      Outputs this mapping instance and returns it in CompressedXContent format
      Returns:
      the CompressedXContent representation of this mapping instance
    • type

      public String type()
    • getMeta

      public Map<String,​Object> getMeta()
      Returns the meta section for the current mapping
    • getMetadataMapperByClass

      public <T extends MetadataFieldMapper> T getMetadataMapperByClass(Class<T> clazz)
      Get the metadata mapper with the given class.
    • merge

      public Mapping merge(Mapping mergeWith, MapperService.MergeReason reason)
      Merges a new mapping into the existing one.
      Parameters:
      mergeWith - the new mapping to merge into this one.
      reason - the reason this merge was initiated.
      Returns:
      the resulting merged mapping.
    • toXContent

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

      public String toString()
      Overrides:
      toString in class Object