Package org.elasticsearch.index.mapper
Class DocumentParserContext
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
ConstructorsModifierConstructorDescriptionprotectedDocumentParserContext(MappingLookup mappingLookup, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, Function<DateFormatter,MappingParserContext> parserContextFunction, SourceToParse source) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidaddDoc(LuceneDocument doc)voidaddDynamicMapper(Mapper mapper)Add a new mapper dynamically created while parsing.voidaddDynamicRuntimeField(RuntimeField runtimeField)Add a new runtime field dynamically created while parsing.voidaddIgnoredField(String field)Add the givenfieldto the set of ignored fields.voidaddToFieldNames(String field)Add the givenfieldto the _field_names field Use this if an exists query run against the field cannot use docvalues or norms.Return a new context that will be within a copy-to operation.Return a new context that will be within multi-fields.createNestedContext(String fullPath)Return a new context that will be used within a nested document.abstract LuceneDocumentdoc()dynamicTemplateParserContext(DateFormatter dateFormatter)findDynamicTemplate(String fieldName, DynamicTemplate.XContentFieldType matchType)Find a dynamic mapping template for the given field and its matching typeGet dynamic mappers created while parsing.Get dynamic runtime fields created while parsing.Return the collection of fields that have been ignored so far.getMetadataMapper(String mapperName)getObjectMapper(String name)booleanisShadowed(String field)booleanbooleanabstract Iterable<LuceneDocument>Returns an Iterable over all non-root documents.overridePath(ContentPath path)Return a new context that will have the provided path.abstract org.elasticsearch.xcontent.XContentParserparser()abstract ContentPathpath()root()abstract LuceneDocumentrootDoc()seqID()voidswitchDoc(LuceneDocument document)Return a new context that has the provided document as the current document.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 methodorg.apache.lucene.document.Fieldversion()voidversion(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 givenfieldto the set of ignored fields. -
getIgnoredFields
Return the collection of fields that have been ignored so far. -
addToFieldNames
Add the givenfieldto 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
-
seqID
-
addDynamicMapper
Add a new mapper dynamically created while parsing. -
getDynamicMappers
Get dynamic mappers created while parsing. -
isShadowed
-
getObjectMapper
-
addDynamicRuntimeField
Add a new runtime field dynamically created while parsing. -
getDynamicRuntimeFields
Get dynamic runtime fields created while parsing. -
nonRootDocuments
Returns an Iterable over all non-root documents. If there are no non-root documents the iterable will return an empty iterator. -
createCopyToContext
Return a new context that will be within a copy-to operation. -
isWithinCopyTo
public boolean isWithinCopyTo() -
createMultiFieldContext
Return a new context that will be within multi-fields. -
isWithinMultiFields
public boolean isWithinMultiFields() -
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. -
overridePath
Return a new context that will have the provided path. -
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 -
path
-
parser
public abstract org.elasticsearch.xcontent.XContentParser 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.
-