Class MetadataFieldMapper

java.lang.Object
org.elasticsearch.index.mapper.Mapper
org.elasticsearch.index.mapper.FieldMapper
org.elasticsearch.index.mapper.MetadataFieldMapper
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Iterable<Mapper>, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentFragment
Direct Known Subclasses:
AllFieldMapper, DocCountFieldMapper, FieldNamesFieldMapper, IdFieldMapper, IgnoredFieldMapper, IndexFieldMapper, RoutingFieldMapper, SeqNoFieldMapper, SourceFieldMapper, TypeFieldMapper, VersionFieldMapper

public abstract class MetadataFieldMapper
extends FieldMapper
A mapper for a builtin field containing metadata about a document.
  • Constructor Details

  • Method Details

    • updateableBoolParam

      public static FieldMapper.Parameter<Explicit<java.lang.Boolean>> updateableBoolParam​(java.lang.String name, java.util.function.Function<FieldMapper,​Explicit<java.lang.Boolean>> initializer, boolean defaultValue)
      Declares an updateable boolean parameter for a metadata field We need to distinguish between explicit configuration and default value for metadata fields, because mapping updates will carry over the previous metadata values if a metadata field is not explicitly declared in the update. A standard boolean parameter explicitly configured with a default value will not be serialized (as we do not serialize default parameters for mapping updates), and as such will be ignored by the update merge. Instead, we use an Explicit object that will serialize its value if it has been configured, no matter what the value is.
    • getMergeBuilder

      public FieldMapper.Builder getMergeBuilder()
      Description copied from class: FieldMapper
      Returns a FieldMapper.Builder to be used for merging and serialization Implement as follows: return new MyBuilder(simpleName()).init(this);
      Specified by:
      getMergeBuilder in class FieldMapper
    • toXContent

      public final 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
      Overrides:
      toXContent in class FieldMapper
      Throws:
      java.io.IOException
    • parseCreateField

      protected void parseCreateField​(ParseContext context) throws java.io.IOException
      Description copied from class: FieldMapper
      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
      Specified by:
      parseCreateField in class FieldMapper
      Throws:
      java.io.IOException
    • preParse

      public void preParse​(ParseContext context) throws java.io.IOException
      Throws:
      java.io.IOException
    • postParse

      public void postParse​(ParseContext context) throws java.io.IOException
      Throws:
      java.io.IOException