java.lang.Object
org.elasticsearch.index.mapper.DocumentParserContext
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 Summary
ModifierConstructorDescriptionprotected
DocumentParserContext
(MappingLookup mappingLookup, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, Function<DateFormatter, MappingParserContext> parserContextFunction, SourceToParse source) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
addDoc
(LuceneDocument doc) final void
addDynamicMapper
(Mapper mapper) Add a new mapper dynamically created while parsing.final void
addIgnoredField
(String field) Add the givenfield
to the set of ignored fields.final void
addToFieldNames
(String field) Add the givenfield
to the _field_names field Use this if an exists query run against the field cannot use docvalues or norms.final DocumentParserContext
createCopyToContext
(String copyToField, LuceneDocument doc) Return a context for copy_to directivesfinal MapperBuilderContext
final DocumentParserContext
createNestedContext
(String fullPath) Return a new context that will be used within a nested document.abstract LuceneDocument
doc()
final String
Description on the document being parsed used in error messages.final MappingParserContext
dynamicTemplateParserContext
(DateFormatter dateFormatter) final DynamicTemplate
findDynamicTemplate
(String fieldName, DynamicTemplate.XContentFieldType matchType) Find a dynamic mapping template for the given field and its matching typeThe collection of dimensions for this document.Get dynamic mappers created as a result of parsing an incoming document.final List<RuntimeField>
Get dynamic runtime fields created while parsing.final Collection<String>
Return the collection of fields that have been ignored so far.final MetadataFieldMapper
getMetadataMapper
(String mapperName) final String
id()
final void
final IndexAnalyzers
final IndexSettings
final boolean
Is this index configured to use synthetic source?boolean
final MappingLookup
abstract Iterable<LuceneDocument>
Returns an Iterable over all non-root documents.abstract XContentParser
parser()
abstract ContentPath
path()
final RootObjectMapper
root()
abstract LuceneDocument
rootDoc()
seqID()
final void
final SourceToParse
final DocumentParserContext
switchDoc
(LuceneDocument document) Return a new context that has the provided document as the current document.final DocumentParserContext
switchParser
(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 contextfinal RootObjectMapper.Builder
final org.apache.lucene.document.Field
version()
final void
version
(org.apache.lucene.document.Field version)
-
Constructor Details
-
DocumentParserContext
protected DocumentParserContext(MappingLookup mappingLookup, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, Function<DateFormatter, MappingParserContext> parserContextFunction, SourceToParse source)
-
-
Method Details
-
indexSettings
-
indexAnalyzers
-
root
-
mappingLookup
-
getMetadataMapper
-
dynamicTemplateParserContext
-
sourceToParse
-
addIgnoredField
Add the givenfield
to the set of ignored fields. -
getIgnoredFields
Return the collection of fields that have been ignored so far. -
addToFieldNames
Add the givenfield
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) -
id
-
id
-
seqID
-
seqID
-
documentDescription
Description on the document being parsed used in error messages. Not called unless there is an error. -
addDynamicMapper
Add a new mapper dynamically created while parsing. -
getDynamicMappers
Get dynamic mappers created as a result of parsing an incoming document. Responsible for exposing all the newly created fields that need to be merged into the existing mappings. Used to create the required mapping update at the end of document parsing. Consists of a flat set ofMapper
s that will need to be added to their respective parentObjectMapper
s in order to become part of the resulting dynamic mapping update. -
getDynamicRuntimeFields
Get dynamic runtime fields created while parsing. Holds a flat set ofRuntimeField
s. Runtime fields get dynamically mapped whenObjectMapper.Dynamic.RUNTIME
is used, or when dynamic templates specify aruntime
section. -
nonRootDocuments
Returns an Iterable over all non-root documents. If there are no non-root documents the iterable will return an empty iterator. -
updateRoot
- Returns:
- a RootObjectMapper.Builder to be used to construct a dynamic mapping update
-
isWithinCopyTo
public boolean isWithinCopyTo() -
createNestedContext
Return a new context that will be used within a nested document. -
switchDoc
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 todoc
- the document to target- Throws:
IOException
-
switchParser
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
-
getDimensions
The collection of dimensions for this document. -
path
-
createMapperBuilderContext
-
parser
-
rootDoc
-
doc
-
addDoc
-
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 fieldmatchType
- 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.
-
isSyntheticSource
public final boolean isSyntheticSource()Is this index configured to use synthetic source?
-