java.lang.Object
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.mapper.MapperService
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe reason why a mapping is being merged. -
Field Summary
FieldsModifier and TypeFieldDescriptionDeprecated.static final NodeFeaturestatic final Stringstatic final StringFields inherited from class org.elasticsearch.index.AbstractIndexComponent
indexSettings, logger -
Constructor Summary
ConstructorsConstructorDescriptionMapperService(Supplier<TransportVersion> clusterTransportVersion, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, IdFieldMapper idFieldMapper, ScriptCompiler scriptCompiler, Function<org.apache.lucene.search.Query, org.apache.lucene.search.join.BitSetProducer> bitSetProducer, MapperMetrics mapperMetrics) MapperService(ClusterService clusterService, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, IdFieldMapper idFieldMapper, ScriptCompiler scriptCompiler, Function<org.apache.lucene.search.Query, org.apache.lucene.search.join.BitSetProducer> bitSetProducer, MapperMetrics mapperMetrics) -
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.Function<org.apache.lucene.search.Query, org.apache.lucene.search.join.BitSetProducer> Returns field types that have eager global ordinals.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 insteadbooleanisMultiField(String field) Exposes a snapshot of the mappings for the current index.longmerge(String type, List<CompressedXContent> mappingSources, MapperService.MergeReason reason) Merging the provided mappings.merge(String type, CompressedXContent mappingSource, MapperService.MergeReason reason) voidmerge(IndexMetadata indexMetadata, MapperService.MergeReason reason) static MappingmergeMappings(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason, IndexSettings indexSettings) parseMapping(String mappingType, MapperService.MergeReason reason, Map<String, Object> mappingSource) A method to parse mapping from a source in a map form.parseMapping(String mappingType, MapperService.MergeReason reason, CompressedXContent mappingSource) parseMapping(NamedXContentRegistry xContentRegistry, String mappingSource) Parses the mappings (formatted as JSON) into a mapparseMapping(NamedXContentRegistry xContentRegistry, CompressedXContent mappingSource) Parses the mappings (formatted as JSON) into a mapreloadSearchAnalyzers(AnalysisRegistry registry, String resource, boolean preview) Reload any search analyzers that have reloadable components if resource isnull, otherwise only the provided resource is reloaded.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
-
LOGSDB_DEFAULT_IGNORE_DYNAMIC_BEYOND_LIMIT
-
INDEX_MAPPING_IGNORE_DYNAMIC_BEYOND_LIMIT_SETTING
-
INDEX_MAPPING_DEPTH_LIMIT_SETTING
-
INDEX_MAPPING_FIELD_NAME_LENGTH_LIMIT_SETTING
-
INDEX_MAPPING_DIMENSION_FIELDS_LIMIT_SETTING
-
INDEX_MAPPER_DYNAMIC_SETTING
Deprecated.Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use. TODO: Remove in 9.0
-
-
Constructor Details
-
MapperService
public MapperService(ClusterService clusterService, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, IdFieldMapper idFieldMapper, ScriptCompiler scriptCompiler, Function<org.apache.lucene.search.Query, org.apache.lucene.search.join.BitSetProducer> bitSetProducer, MapperMetrics mapperMetrics) -
MapperService
public MapperService(Supplier<TransportVersion> clusterTransportVersion, IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, IdFieldMapper idFieldMapper, ScriptCompiler scriptCompiler, Function<org.apache.lucene.search.Query, org.apache.lucene.search.join.BitSetProducer> bitSetProducer, MapperMetrics mapperMetrics)
-
-
Method Details
-
hasNested
public boolean hasNested() -
getIndexAnalyzers
-
parserContext
-
documentParser
Exposes aDocumentParser- Returns:
- a document parser to be used to parse incoming documents
-
parseMapping
public static Map<String,Object> parseMapping(NamedXContentRegistry xContentRegistry, String mappingSource) throws IOException Parses the mappings (formatted as JSON) into a map- Throws:
IOException
-
parseMapping
public static Map<String,Object> parseMapping(NamedXContentRegistry xContentRegistry, CompressedXContent mappingSource) throws IOException Parses the mappings (formatted as JSON) into a map- Throws:
IOException
-
updateMapping
Update local mapping by applying the incoming mapping that have already been merged with the current one on the master -
merge
-
merge
public DocumentMapper merge(String type, List<CompressedXContent> mappingSources, MapperService.MergeReason reason) Merging the provided mappings. Actual merging is done in the raw, non-parsed, form of the mappings. This allows to do a proper bulk merge, where parsing is done only when all raw mapping settings are already merged. -
merge
public DocumentMapper merge(String type, CompressedXContent mappingSource, MapperService.MergeReason reason) -
parseMapping
public Mapping parseMapping(String mappingType, MapperService.MergeReason reason, CompressedXContent mappingSource) -
parseMapping
public Mapping parseMapping(String mappingType, MapperService.MergeReason reason, Map<String, Object> mappingSource) A method to parse mapping from a source in a map form.- Parameters:
mappingType- the mapping typereason- the merge reason to use when merging mappers while building the mappermappingSource- mapping source already converted to a map form, but not yet processed otherwise- Returns:
- a parsed mapping
-
mergeMappings
public static Mapping mergeMappings(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason, IndexSettings indexSettings) -
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) -
mappingVersion
public long mappingVersion() -
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 field types that have eager global ordinals. -
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
-
isMultiField
- Returns:
- If this field is defined as a multifield of another field
-
reloadSearchAnalyzers
public List<String> reloadSearchAnalyzers(AnalysisRegistry registry, @Nullable String resource, boolean preview) throws IOException Reload any search analyzers that have reloadable components if resource isnull, otherwise only the provided resource is reloaded.- Parameters:
registry- the analysis registryresource- the name of the reloadable resource ornullif all resources should be reloaded.preview-falseapplies analyzer reloading.truepreviews the reloading operation, so analyzers are not reloaded but the results retrieved. This is useful for understanding analyzers usage in the different indices.- Returns:
- The names of reloaded resources (or resources that would be reloaded if
previewis true). - Throws:
IOException
-
getAllDynamicTemplates
- Returns:
- Returns all dynamic templates defined in this mapping.
-
getMapperRegistry
-
getBitSetProducer
public Function<org.apache.lucene.search.Query,org.apache.lucene.search.join.BitSetProducer> getBitSetProducer() -
getMapperMetrics
-