java.lang.Object
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.IndexService
- All Implemented Interfaces:
Iterable<IndexShard>,IndicesClusterStateService.AllocatedIndex<IndexShard>
public class IndexService
extends AbstractIndexComponent
implements IndicesClusterStateService.AllocatedIndex<IndexShard>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.elasticsearch.index.AbstractIndexComponent
deprecationLogger, logger -
Constructor Summary
ConstructorsConstructorDescriptionIndexService(IndexSettings indexSettings, IndexService.IndexCreationContext indexCreationContext, NodeEnvironment nodeEnv, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, IndexService.ShardStoreDeleter shardStoreDeleter, IndexAnalyzers indexAnalyzers, EngineFactory engineFactory, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ScriptService scriptService, ClusterService clusterService, Client client, QueryCache queryCache, IndexStorePlugin.DirectoryFactory directoryFactory, IndexEventListener eventListener, Function<IndexService, CheckedFunction<org.apache.lucene.index.DirectoryReader, org.apache.lucene.index.DirectoryReader, IOException>> wrapperFactory, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, List<SearchOperationListener> searchOperationListeners, List<IndexingOperationListener> indexingOperationListeners, NamedWriteableRegistry namedWriteableRegistry, IdFieldMapper idFieldMapper, BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.RecoveryStateFactory recoveryStateFactory, IndexStorePlugin.IndexFoldersDeletionListener indexFoldersDeletionListener, IndexStorePlugin.SnapshotCommitSupplier snapshotCommitSupplier, Engine.IndexCommitListener indexCommitListener, Supplier<DocumentParsingObserver> documentParsingObserverSupplier) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMetadataListener(Consumer<IndexMetadata> listener) cache()booleanclearCaches(boolean queryCache, boolean fieldDataCache, String... fields) Clears the caches for the given shard id if the shard is still allocated on this nodevoidcreateRecoveryState(ShardRouting shardRouting, DiscoveryNode targetNode, DiscoveryNode sourceNode) createShard(ShardRouting routing, GlobalCheckpointSyncer globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer) dateMathExpressionResolverAt(long instant) voidTheBigArraysto use for this index.final EngineFactoryReturns the index settings of this index.Supplier<org.apache.lucene.search.Sort>TheScriptServiceto use for this index.getShard(int shardId) Return the shard with the provided id, or throw an exception if it doesn't exist.getShardOrNull(int shardId) Return the shard with the provided id, or null if there is no such shard.TheThreadPoolto use for this index.booleanhasShard(int shardId) iterator()newQueryRewriteContext(LongSupplier nowInMillis, Map<String, Object> runtimeMappings, String clusterAlias) Creates a newQueryRewriteContext.newSearchExecutionContext(int shardId, int shardRequestIndex, org.apache.lucene.search.IndexSearcher searcher, LongSupplier nowInMillis, String clusterAlias, Map<String, Object> runtimeMappings) Creates a newSearchExecutionContext.intstatic Map<String,MappedFieldType> parseRuntimeMappings(Map<String, Object> runtimeMappings, MapperService mapperService, IndexSettings indexSettings, MappingLookup lookup) voidremoveShard(int shardId, String reason) Removes shard with given id.shardIds()voidupdateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) Updates the mappings by applying the incoming onesvoidupdateMetadata(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) Updates the metadata of this index.voidMethods inherited from class org.elasticsearch.index.AbstractIndexComponent
indexMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING
-
RETENTION_LEASE_SYNC_INTERVAL_SETTING
-
-
Constructor Details
-
IndexService
public IndexService(IndexSettings indexSettings, IndexService.IndexCreationContext indexCreationContext, NodeEnvironment nodeEnv, XContentParserConfiguration parserConfiguration, SimilarityService similarityService, IndexService.ShardStoreDeleter shardStoreDeleter, IndexAnalyzers indexAnalyzers, EngineFactory engineFactory, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ScriptService scriptService, ClusterService clusterService, Client client, QueryCache queryCache, IndexStorePlugin.DirectoryFactory directoryFactory, IndexEventListener eventListener, Function<IndexService, CheckedFunction<org.apache.lucene.index.DirectoryReader, org.apache.lucene.index.DirectoryReader, IOException>> wrapperFactory, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, List<SearchOperationListener> searchOperationListeners, List<IndexingOperationListener> indexingOperationListeners, NamedWriteableRegistry namedWriteableRegistry, IdFieldMapper idFieldMapper, BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.RecoveryStateFactory recoveryStateFactory, IndexStorePlugin.IndexFoldersDeletionListener indexFoldersDeletionListener, IndexStorePlugin.SnapshotCommitSupplier snapshotCommitSupplier, Engine.IndexCommitListener indexCommitListener, Supplier<DocumentParsingObserver> documentParsingObserverSupplier)
-
-
Method Details
-
numberOfShards
public int numberOfShards() -
getIndexEventListener
-
iterator
- Specified by:
iteratorin interfaceIterable<IndexShard>
-
hasShard
public boolean hasShard(int shardId) -
getShardOrNull
Return the shard with the provided id, or null if there is no such shard.- Specified by:
getShardOrNullin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
-
getShard
Return the shard with the provided id, or throw an exception if it doesn't exist. -
getNodeMappingStats
-
shardIds
-
cache
-
getIndexAnalyzers
-
mapperService
-
similarityService
-
getIndexSortSupplier
-
close
- Throws:
IOException
-
writeDanglingIndicesInfo
public void writeDanglingIndicesInfo() -
deleteDanglingIndicesInfo
public void deleteDanglingIndicesInfo() -
indexUUID
-
createShard
public IndexShard createShard(ShardRouting routing, GlobalCheckpointSyncer globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer) throws IOException - Throws:
IOException
-
removeShard
Description copied from interface:IndicesClusterStateService.AllocatedIndexRemoves shard with given id.- Specified by:
removeShardin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
-
createRecoveryState
public RecoveryState createRecoveryState(ShardRouting shardRouting, DiscoveryNode targetNode, DiscoveryNode sourceNode) -
getIndexSettings
Description copied from interface:IndicesClusterStateService.AllocatedIndexReturns the index settings of this index.- Specified by:
getIndexSettingsin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>- Overrides:
getIndexSettingsin classAbstractIndexComponent
-
newSearchExecutionContext
public SearchExecutionContext newSearchExecutionContext(int shardId, int shardRequestIndex, org.apache.lucene.search.IndexSearcher searcher, LongSupplier nowInMillis, String clusterAlias, Map<String, Object> runtimeMappings) Creates a newSearchExecutionContext. Passing anullIndexSearcherwill return a valid context, however it won't be able to makeIndexReader-specific optimizations, such as rewriting containing range queries. -
newQueryRewriteContext
public QueryRewriteContext newQueryRewriteContext(LongSupplier nowInMillis, Map<String, Object> runtimeMappings, String clusterAlias) Creates a newQueryRewriteContext. This class is used to rewrite queries in case access to the index is not required, since we can decide rewriting based on mappings alone. This saves the cost of pulling an index searcher as well as the associated cost of refreshing idle shards. -
getThreadPool
TheThreadPoolto use for this index. -
getBigArrays
TheBigArraysto use for this index. -
getScriptService
TheScriptServiceto use for this index. -
updateMapping
Description copied from interface:IndicesClusterStateService.AllocatedIndexUpdates the mappings by applying the incoming ones- Specified by:
updateMappingin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
-
getMetadata
-
addMetadataListener
-
updateMetadata
Description copied from interface:IndicesClusterStateService.AllocatedIndexUpdates the metadata of this index. Changes become visible throughIndicesClusterStateService.AllocatedIndex.getIndexSettings().- Specified by:
updateMetadatain interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>- Parameters:
currentIndexMetadata- the current index metadatanewIndexMetadata- the new index metadata
-
dateMathExpressionResolverAt
-
dateMathExpressionResolverAt
-
getEngineFactory
-
clearCaches
Clears the caches for the given shard id if the shard is still allocated on this node -
parseRuntimeMappings
public static Map<String,MappedFieldType> parseRuntimeMappings(Map<String, Object> runtimeMappings, MapperService mapperService, IndexSettings indexSettings, MappingLookup lookup)
-