Class DocumentParserContext

java.lang.Object
org.elasticsearch.index.mapper.DocumentParserContext

public abstract class DocumentParserContext extends Object
Context used when parsing incoming documents. Holds everything that is needed to parse a document as well as the lucene data structures and mappings to be dynamically created as the outcome of parsing a document.
  • Constructor Details

  • Method Details

    • indexSettings

      public final IndexSettings indexSettings()
    • indexAnalyzers

      public final IndexAnalyzers indexAnalyzers()
    • root

      public final RootObjectMapper root()
    • mappingLookup

      public final MappingLookup mappingLookup()
    • getMetadataMapper

      public final MetadataFieldMapper getMetadataMapper(String mapperName)
    • dynamicTemplateParserContext

      public final MappingParserContext dynamicTemplateParserContext(DateFormatter dateFormatter)
    • sourceToParse

      public final SourceToParse sourceToParse()
    • addIgnoredField

      public final void addIgnoredField(String field)
      Add the given field to the set of ignored fields.
    • getIgnoredFields

      public final Collection<String> getIgnoredFields()
      Return the collection of fields that have been ignored so far.
    • addToFieldNames

      public final void addToFieldNames(String field)
      Add the given field to the _field_names field Use this if an exists query run against the field cannot use docvalues or norms.
    • version

      public final org.apache.lucene.document.Field version()
    • version

      public final void version(org.apache.lucene.document.Field version)
    • seqID

      public final SeqNoFieldMapper.SequenceIDFields seqID()
    • seqID

      public final void seqID(SeqNoFieldMapper.SequenceIDFields seqID)
    • addDynamicMapper

      public final void addDynamicMapper(Mapper mapper)
      Add a new mapper dynamically created while parsing.
    • getDynamicMappers

      public final List<Mapper> getDynamicMappers()
      Get dynamic mappers created while parsing.
    • isShadowed

      public final boolean isShadowed(String field)
    • getDynamicObjectMapper

      public final ObjectMapper getDynamicObjectMapper(String name)
    • addDynamicRuntimeField

      public final void addDynamicRuntimeField(RuntimeField runtimeField)
      Add a new runtime field dynamically created while parsing.
    • getDynamicRuntimeFields

      public final List<RuntimeField> getDynamicRuntimeFields()
      Get dynamic runtime fields created while parsing.
    • nonRootDocuments

      public abstract Iterable<LuceneDocument> nonRootDocuments()
      Returns an Iterable over all non-root documents. If there are no non-root documents the iterable will return an empty iterator.
    • updateRoot

      public final RootObjectMapper.Builder updateRoot()
      Returns:
      a RootObjectMapper.Builder to be used to construct a dynamic mapping update
    • isWithinCopyTo

      public boolean isWithinCopyTo()
    • createNestedContext

      public final DocumentParserContext createNestedContext(String fullPath)
      Return a new context that will be used within a nested document.
    • switchDoc

      public final DocumentParserContext switchDoc(LuceneDocument document)
      Return a new context that has the provided document as the current document.
    • createCopyToContext

      public final DocumentParserContext createCopyToContext(String copyToField, LuceneDocument doc) throws IOException
      Return a context for copy_to directives
      Parameters:
      copyToField - the name of the field to copy to
      doc - the document to target
      Throws:
      IOException
    • switchParser

      @Deprecated public final DocumentParserContext switchParser(org.elasticsearch.xcontent.XContentParser parser)
      Deprecated.
      we are actively deprecating and removing the ability to pass complex objects to multifields, so try and avoid using this method Replace the XContentParser used by this context
      Parameters:
      parser - the replacement parser
      Returns:
      a new context with a replaced parser
    • path

      public abstract ContentPath path()
    • parser

      public abstract org.elasticsearch.xcontent.XContentParser parser()
    • rootDoc

      public abstract LuceneDocument rootDoc()
    • doc

      public abstract LuceneDocument doc()
    • addDoc

      protected abstract void addDoc(LuceneDocument doc)
    • findDynamicTemplate

      public final DynamicTemplate findDynamicTemplate(String fieldName, DynamicTemplate.XContentFieldType matchType)
      Find a dynamic mapping template for the given field and its matching type
      Parameters:
      fieldName - the name of the field
      matchType - the expecting matchType of the field
      Returns:
      the matching template; otherwise returns null
      Throws:
      MapperParsingException - if the given field has a dynamic template name specified, but no template matches that name.