Package org.elasticsearch.index.mapper
Class MapperService
java.lang.Object
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.mapper.MapperService
- All Implemented Interfaces:
Closeable,AutoCloseable,IndexComponent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe reason why a mapping is being merged. -
Field Summary
FieldsFields inherited from class org.elasticsearch.index.AbstractIndexComponent
deprecationLogger, indexSettings, logger -
Constructor Summary
ConstructorsConstructorDescriptionMapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, BooleanSupplier idFieldDataEnabled, ScriptCompiler scriptCompiler) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Return the document mapper, ornullif no mapping has been put yet or no documents have been indexed in the current index yet (which triggers a dynamic mapping update)Exposes aDocumentParserGiven the full name of a field, returns itsMappedFieldType.Returns all mapped field types.getNamedAnalyzer(String analyzerName) booleanindexAnalyzer(String field, Function<String, NamedAnalyzer> unindexedFieldAnalyzer) Return the index-time analyzer associated with a particular fieldstatic booleanisMappingSourceTyped(String type, Map<String, Object> mapping) Returnstrueif the givenmappingSourceincludes a type as a top-level object.booleanisMetadataField(String field) static booleanisMetadataFieldStatic(String fieldName) Deprecated.Use an instance method isMetadataField insteadExposes a snapshot of the mappings for the current index.voidmerge(String type, CompressedXContent mappingSource, MapperService.MergeReason reason) voidmerge(IndexMetadata indexMetadata, MapperService.MergeReason reason) static MappingmergeMappings(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason) parseMapping(String mappingType, CompressedXContent mappingSource) parseMapping(org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, String mappingSource) Parses the mappings (formatted as JSON) into a mapreloadSearchAnalyzers(AnalysisRegistry registry) voidupdateMapping(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
-
Field Details
-
SINGLE_MAPPING_NAME
- See Also:
-
TYPE_FIELD_NAME
- See Also:
-
INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING
-
INDEX_MAPPING_NESTED_DOCS_LIMIT_SETTING
-
INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING
-
INDEX_MAPPING_DEPTH_LIMIT_SETTING
-
INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING
-
INDEX_MAPPING_DIMENSION_FIELDS_LIMIT_SETTING
-
-
Constructor Details
-
MapperService
public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, BooleanSupplier idFieldDataEnabled, ScriptCompiler scriptCompiler)
-
-
Method Details
-
hasNested
public boolean hasNested() -
getIndexAnalyzers
-
getNamedAnalyzer
-
parserContext
-
documentParser
Exposes aDocumentParser- Returns:
- a document parser to be used to parse incoming documents
-
parseMapping
public static Map<String,Object> parseMapping(org.elasticsearch.xcontent.NamedXContentRegistry xContentRegistry, String mappingSource) throws IOException Parses the mappings (formatted as JSON) into a map- Throws:
IOException
-
updateMapping
public void updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) throws IOException Update local mapping by applying the incoming mapping that have already been merged with the current one on the master- Throws:
IOException
-
merge
public void merge(String type, Map<String, Object> mappings, MapperService.MergeReason reason) throws IOException- Throws:
IOException
-
merge
-
merge
public DocumentMapper merge(String type, CompressedXContent mappingSource, MapperService.MergeReason reason) -
parseMapping
-
mergeMappings
public static Mapping mergeMappings(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason) -
documentMapper
Return the document mapper, ornullif no mapping has been put yet or no documents have been indexed in the current index yet (which triggers a dynamic mapping update) -
isMappingSourceTyped
Returnstrueif the givenmappingSourceincludes a type as a top-level object. -
fieldType
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 emptyMappingLookupinstance 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 NamedAnalyzer indexAnalyzer(String field, Function<String, 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
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isMetadataFieldStatic
Deprecated.Use an instance method isMetadataField instead- Returns:
- Whether a field is a metadata field Deserialization of SearchHit objects sent from pre 7.8 nodes and GetResults objects sent from pre 7.3 nodes, uses this method to divide fields into meta and document fields. TODO: remove in v 9.0
-
isMetadataField
- Returns:
- Whether a field is a metadata field. this method considers all mapper plugins
-
reloadSearchAnalyzers
- Throws:
IOException
-