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
Modifier and TypeClassDescriptionstatic class
static interface
-
Field Summary
Modifier 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
ConstructorDescriptionIndexService(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 TypeMethodDescriptionvoid
addMetadataListener(Consumer<IndexMetadata> listener)
cache()
boolean
clearCaches(boolean queryCache, boolean fieldDataCache, String... fields)
Clears the caches for the given shard id if the shard is still allocated on this nodevoid
createRecoveryState(ShardRouting shardRouting, DiscoveryNode targetNode, DiscoveryNode sourceNode)
createShard(ShardRouting routing, Consumer<ShardId> globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer)
dateMathExpressionResolverAt(long instant)
void
TheBigArrays
to use for this index.Returns the index settings of this index.Supplier<org.apache.lucene.search.Sort>
TheScriptService
to 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.TheThreadPool
to use for this index.boolean
hasShard(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.int
void
removeShard(int shardId, String reason)
Removes shard with given id.shardIds()
void
updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata)
Updates the mappings by applying the incoming onesvoid
updateMetadata(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata)
Updates the metadata of this index.void
org.elasticsearch.common.xcontent.NamedXContentRegistry
Methods inherited from class org.elasticsearch.index.AbstractIndexComponent
index
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.elasticsearch.index.IndexComponent
index
Methods 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:
iterator
in 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:
getShardOrNull
in 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.AllocatedIndex
Removes shard with given id.- Specified by:
removeShard
in interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
-
createRecoveryState
public RecoveryState createRecoveryState(ShardRouting shardRouting, DiscoveryNode targetNode, DiscoveryNode sourceNode) -
getIndexSettings
Description copied from interface:IndicesClusterStateService.AllocatedIndex
Returns the index settings of this index.- Specified by:
getIndexSettings
in interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
- Overrides:
getIndexSettings
in 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 anull
IndexSearcher
will return a valid context, however it won't be able to makeIndexReader
-specific optimizations, such as rewriting containing range queries. -
getThreadPool
TheThreadPool
to use for this index. -
getBigArrays
TheBigArrays
to use for this index. -
getScriptService
TheScriptService
to use for this index. -
updateMapping
public void updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) throws IOExceptionDescription copied from interface:IndicesClusterStateService.AllocatedIndex
Updates the mappings by applying the incoming ones- Specified by:
updateMapping
in interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
- Throws:
IOException
-
getMetadata
-
addMetadataListener
-
updateMetadata
Description copied from interface:IndicesClusterStateService.AllocatedIndex
Updates the metadata of this index. Changes become visible throughIndicesClusterStateService.AllocatedIndex.getIndexSettings()
.- Specified by:
updateMetadata
in 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
-