java.lang.Object
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.mapper.MapperService
- All Implemented Interfaces:
Closeable
,AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The 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, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, IdFieldMapper idFieldMapper, 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)Exposes aDocumentParser
Given the full name of a field, returns itsMappedFieldType
.Returns field types that have eager global ordinals.boolean
indexAnalyzer
(String field, Function<String, NamedAnalyzer> unindexedFieldAnalyzer) Return the index-time analyzer associated with a particular fieldstatic boolean
isMappingSourceTyped
(String type, Map<String, Object> mapping) Returnstrue
if the givenmappingSource
includes a type as a top-level object.boolean
isMetadataField
(String field) static boolean
isMetadataFieldStatic
(String fieldName) Deprecated.Use an instance method isMetadataField insteadboolean
isMultiField
(String field) Exposes a snapshot of the mappings for the current index.merge
(String type, CompressedXContent mappingSource, MapperService.MergeReason reason) void
merge
(IndexMetadata indexMetadata, MapperService.MergeReason reason) static Mapping
mergeMappings
(DocumentMapper currentMapper, Mapping incomingMapping, MapperService.MergeReason reason) parseMapping
(String mappingType, 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) 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
-
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, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, MapperRegistry mapperRegistry, Supplier<SearchExecutionContext> searchExecutionContextSupplier, IdFieldMapper idFieldMapper, ScriptCompiler scriptCompiler)
-
-
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, CompressedXContent mappingSource, MapperService.MergeReason reason) -
parseMapping
-
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) -
isMappingSourceTyped
Returnstrue
if the givenmappingSource
includes 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 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 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:
close
in interfaceAutoCloseable
- Specified by:
close
in 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
- Throws:
IOException
-