Package org.elasticsearch.index
Class IndexService
java.lang.Object
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.IndexService
- All Implemented Interfaces:
Iterable<IndexShard>,IndexComponent,IndicesClusterStateService.AllocatedIndex<IndexShard>
public class IndexService
extends AbstractIndexComponent
implements IndicesClusterStateService.AllocatedIndex<IndexShard>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Setting<org.elasticsearch.core.TimeValue>static Setting<org.elasticsearch.core.TimeValue>Fields inherited from class org.elasticsearch.index.AbstractIndexComponent
deprecationLogger, logger -
Constructor Summary
ConstructorsConstructorDescriptionIndexService(IndexSettings indexSettings, IndexService.IndexCreationContext indexCreationContext, NodeEnvironment nodeEnv, org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry, 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,org.elasticsearch.core.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, BooleanSupplier idFieldDataEnabled, BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.RecoveryStateFactory recoveryStateFactory, IndexStorePlugin.IndexFoldersDeletionListener indexFoldersDeletionListener, IndexStorePlugin.SnapshotCommitSupplier snapshotCommitSupplier) -
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, Consumer<ShardId> globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer)dateMathExpressionResolverAt(long instant)voidTheBigArraysto use for this index.Returns 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()newSearchExecutionContext(int shardId, int shardRequestIndex, org.apache.lucene.search.IndexSearcher searcher, LongSupplier nowInMillis, String clusterAlias, Map<String,Object> runtimeMappings)Creates a new QueryShardContext.intvoidremoveShard(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.voidorg.elasticsearch.common.xcontent.NamedXContentRegistryMethods 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 org.elasticsearch.index.IndexComponent
indexMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING
public static final Setting<org.elasticsearch.core.TimeValue> GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING -
RETENTION_LEASE_SYNC_INTERVAL_SETTING
-
-
Constructor Details
-
IndexService
public IndexService(IndexSettings indexSettings, IndexService.IndexCreationContext indexCreationContext, NodeEnvironment nodeEnv, org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry, 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,org.elasticsearch.core.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, BooleanSupplier idFieldDataEnabled, BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.RecoveryStateFactory recoveryStateFactory, IndexStorePlugin.IndexFoldersDeletionListener indexFoldersDeletionListener, IndexStorePlugin.SnapshotCommitSupplier snapshotCommitSupplier)
-
-
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. -
shardIds
-
cache
-
getIndexAnalyzers
-
mapperService
-
xContentRegistry
public org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry() -
similarityService
-
getIndexSortSupplier
-
close
- Throws:
IOException
-
writeDanglingIndicesInfo
public void writeDanglingIndicesInfo() -
deleteDanglingIndicesInfo
public void deleteDanglingIndicesInfo() -
indexUUID
-
createShard
public IndexShard createShard(ShardRouting routing, Consumer<ShardId> 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 new QueryShardContext. The context has not types set yet, if types are required set them viaSearchExecutionContext. Passing anullIndexSearcherwill return a valid context, however it won't be able to makeIndexReader-specific optimizations, such as rewriting containing range queries. -
getThreadPool
TheThreadPoolto use for this index. -
getBigArrays
TheBigArraysto use for this index. -
getScriptService
TheScriptServiceto use for this index. -
updateMapping
public void updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) throws IOExceptionDescription copied from interface:IndicesClusterStateService.AllocatedIndexUpdates the mappings by applying the incoming ones- Specified by:
updateMappingin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>- Throws:
IOException
-
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
-