Package org.elasticsearch.index.mapper
Class MapperService
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.mapper.MapperService
- All Implemented Interfaces:
,
,
IndexComponent
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
The reason why a mapping is being merged. -
Field Summary
Modifier and TypeFieldDescriptionstatic
static boolean
static >
Deprecated.static >
static >
static >
static >
static >
static <>
Deprecated.static
Fields inherited from class org.elasticsearch.index.AbstractIndexComponent
indexSettings, logger
-
Constructor Summary
ConstructorDescriptionMapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry, SimilarityService similarityService, MapperRegistry mapperRegistry, <SearchExecutionContext> searchExecutionContextSupplier, idFieldDataEnabled, ScriptCompiler scriptCompiler)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Return the document mapper, ornull
if no mapping has been put yet or no documents have been indexed in the current index yet (which triggers a dynamic mapping update)type)
Return theDocumentMapper
for the given type.Exposes aDocumentParser
fullName)
Given the full name of a field, returns itsMappedFieldType
.Returns all mapped field types.analyzerName)
type, CompressedXContent mappingSource)
If the _type name is _doc and there is no _doc top-level key then this means that we are handling a typeless call.boolean
field, <,NamedAnalyzer> unindexedFieldAnalyzer)
Return the index-time analyzer associated with a particular fieldstatic boolean
type, <,> mapping)
Returnstrue
if the givenmappingSource
includes a type as a top-level object.static boolean
type, CompressedXContent mappingSource)
boolean
field)
Exposes a snapshot of the mappings for the current index.void
type, <,> mappings, MapperService.MergeReason reason)
type, CompressedXContent mappingSource, MapperService.MergeReason reason)
void
<,<,>> mappings, MapperService.MergeReason reason)
void
merge(IndexMetadata indexMetadata, MapperService.MergeReason reason)
static Mapping
mergeMappings(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason)
type, CompressedXContent mappingSource, boolean applyDefault)
static <,>
parseMapping(org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry, mappingSource)
Parses the mappings (formatted as JSON) into a map<>
reloadSearchAnalyzers(AnalysisRegistry registry)
type)
Resolves a type from a mapping-related request into the type that should be used when merging and updating mappings.void
updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata)
Update local mapping by applying the incoming mapping that have already been merged with the current one on the masterMethods inherited from class org.elasticsearch.index.AbstractIndexComponent
getIndexSettings, index
Methods inherited from class java.lang.
, , , , , , , , , ,
-
Field Details
-
DEFAULT_MAPPING
public static final DEFAULT_MAPPING- See Also:
- Constant Field Values
-
SINGLE_MAPPING_NAME
public static final SINGLE_MAPPING_NAME- See Also:
- Constant Field Values
-
INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING
public static final > INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING -
INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING
public static final > INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING -
INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING
public static final > INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING -
INDEX_MAPPING_DEPTH_LIMIT_SETTING
public static final > INDEX_MAPPING_DEPTH_LIMIT_SETTING -
INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING
public static final > INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING -
INDEX_MAPPER_DYNAMIC_DEFAULT
public static final boolean INDEX_MAPPER_DYNAMIC_DEFAULT- See Also:
- Constant Field Values
-
INDEX_MAPPER_DYNAMIC_SETTING
public static final > INDEX_MAPPER_DYNAMIC_SETTINGDeprecated. -
META_FIELDS_BEFORE_7DOT8
public static final <> META_FIELDS_BEFORE_7DOT8Deprecated.
-
-
Constructor Details
-
MapperService
public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry, SimilarityService similarityService, MapperRegistry mapperRegistry, <SearchExecutionContext> searchExecutionContextSupplier, idFieldDataEnabled, ScriptCompiler scriptCompiler)
-
-
Method Details
-
hasNested
public boolean hasNested() -
getIndexAnalyzers
-
getNamedAnalyzer
public analyzerName) -
parserContext
-
documentParser
Exposes aDocumentParser
- Returns:
- a document parser to be used to parse incoming documents
-
parseMapping
public static <,> parseMapping(org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry, mappingSource) throwsParses the mappings (formatted as JSON) into a map- Throws:
-
updateMapping
public void updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) throwsUpdate local mapping by applying the incoming mapping that have already been merged with the current one on the master- Throws:
-
merge
-
merge
- Throws:
-
merge
-
merge
public type, CompressedXContent mappingSource, MapperService.MergeReason reason) -
parseMapping
public type, CompressedXContent mappingSource, boolean applyDefault) -
mergeMappings
public static Mapping mergeMappings(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason) -
documentMapper
Return the document mapper, ornull
if no mapping has been put yet or no documents have been indexed in the current index yet (which triggers a dynamic mapping update) -
documentMapper
public type)Return theDocumentMapper
for the given type. By using the special "_default_" type, you can get aDocumentMapper
for the default mapping. -
isMappingSourceTyped
public static boolean isMappingSourceTyped( type, <,> mapping)Returnstrue
if the givenmappingSource
includes a type as a top-level object. -
isMappingSourceTyped
-
getTypeForUpdate
If the _type name is _doc and there is no _doc top-level key then this means that we are handling a typeless call. In such a case, we override _doc with the actual type name in the mappings. This allows to use typeless APIs on typed indices. -
resolveDocumentType
public resolveDocumentType( type)Resolves a type from a mapping-related request into the type that should be used when merging and updating mappings.If the special `_doc` type is provided, then we replace it with the actual type that is being used in the mappings. This allows typeless APIs such as 'index' or 'put mappings' to work against indices with a custom type name.
-
fieldType
public fullName)Given the full name of a field, returns itsMappedFieldType
. -
mappingLookup
Exposes a snapshot of the mappings for the current index. If no mappings have been registered for the current index, an emptyMappingLookup
instance is returned. An index does not have mappings only if it was created without providing mappings explicitly, and no documents have yet been indexed in it. -
getEagerGlobalOrdinalsFields
Returns all mapped field types. -
indexAnalyzer
public field, <,NamedAnalyzer> unindexedFieldAnalyzer)Return the index-time analyzer associated with a particular field- Parameters:
field
- the field nameunindexedFieldAnalyzer
- a function to return an Analyzer for a field with no directly associated index-time analyzer
-
close
public void close() throws- Specified by:
in interface
- Specified by:
in interface
- Throws:
-
isMetadataField
public boolean isMetadataField( field)- Returns:
- Whether a field is a metadata field. this method considers all mapper plugins
-
reloadSearchAnalyzers
- Throws:
-