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)
    • getObjectMapper

      public final ObjectMapper getObjectMapper(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.
    • createCopyToContext

      public final DocumentParserContext createCopyToContext()
      Return a new context that will be within a copy-to operation.
    • isWithinCopyTo

      public boolean isWithinCopyTo()
    • createMultiFieldContext

      public final DocumentParserContext createMultiFieldContext()
      Return a new context that will be within multi-fields.
    • isWithinMultiFields

      public boolean isWithinMultiFields()
    • 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.
    • overridePath

      public final DocumentParserContext overridePath(ContentPath path)
      Return a new context that will have the provided path.
    • switchParser

      @Deprecated public final DocumentParserContext switchParser(org.elasticsearch.common.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
    • path

      public abstract ContentPath path()
    • parser

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

      public abstract LuceneDocument rootDoc()
    • docs

      public abstract List<LuceneDocument> docs()
    • 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.