Package org.elasticsearch.index
Class IndexService
java.lang.Object
org.elasticsearch.index.AbstractIndexComponent
org.elasticsearch.index.IndexService
- All Implemented Interfaces:
java.lang.Iterable<IndexShard>,IndexComponent,IndicesClusterStateService.AllocatedIndex<IndexShard>
public class IndexService extends AbstractIndexComponent implements IndicesClusterStateService.AllocatedIndex<IndexShard>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIndexService.IndexCreationContextstatic interfaceIndexService.ShardStoreDeleter -
Field Summary
Fields Modifier and Type Field Description static Setting<org.elasticsearch.common.unit.TimeValue>GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTINGstatic Setting<org.elasticsearch.common.unit.TimeValue>RETENTION_LEASE_SYNC_INTERVAL_SETTINGFields inherited from class org.elasticsearch.index.AbstractIndexComponent
deprecationLogger, logger -
Constructor Summary
Constructors Constructor Description 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, java.util.function.Function<IndexService,org.elasticsearch.common.CheckedFunction<org.apache.lucene.index.DirectoryReader,org.apache.lucene.index.DirectoryReader,java.io.IOException>> wrapperFactory, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, java.util.List<SearchOperationListener> searchOperationListeners, java.util.List<IndexingOperationListener> indexingOperationListeners, NamedWriteableRegistry namedWriteableRegistry, java.util.function.BooleanSupplier idFieldDataEnabled, java.util.function.BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.RecoveryStateFactory recoveryStateFactory) -
Method Summary
Modifier and Type Method Description voidaddMetadataListener(java.util.function.Consumer<IndexMetadata> listener)IndexCachecache()booleanclearCaches(boolean queryCache, boolean fieldDataCache, java.lang.String... fields)Clears the caches for the given shard id if the shard is still allocated on this nodevoidclose(java.lang.String reason, boolean delete)RecoveryStatecreateRecoveryState(ShardRouting shardRouting, DiscoveryNode targetNode, DiscoveryNode sourceNode)IndexShardcreateShard(ShardRouting routing, java.util.function.Consumer<ShardId> globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer)voiddeleteDanglingIndicesInfo()BigArraysgetBigArrays()TheBigArraysto use for this index.EngineFactorygetEngineFactory()IndexAnalyzersgetIndexAnalyzers()IndexEventListenergetIndexEventListener()IndexSettingsgetIndexSettings()Returns the index settings of this index.java.util.function.Supplier<org.apache.lucene.search.Sort>getIndexSortSupplier()IndexMetadatagetMetadata()ScriptServicegetScriptService()TheScriptServiceto use for this index.IndexShardgetShard(int shardId)Return the shard with the provided id, or throw an exception if it doesn't exist.IndexShardgetShardOrNull(int shardId)Return the shard with the provided id, or null if there is no such shard.ThreadPoolgetThreadPool()TheThreadPoolto use for this index.booleanhasShard(int shardId)java.lang.StringindexUUID()java.util.Iterator<IndexShard>iterator()MapperServicemapperService()QueryShardContextnewQueryShardContext(int shardId, org.apache.lucene.search.IndexSearcher searcher, java.util.function.LongSupplier nowInMillis, java.lang.String clusterAlias)Creates a new QueryShardContext.intnumberOfShards()voidremoveShard(int shardId, java.lang.String reason)Removes shard with given id.java.util.Set<java.lang.Integer>shardIds()SimilarityServicesimilarityService()booleanupdateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata)Checks if index requires refresh from master.voidupdateMetadata(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata)Updates the metadata of this index.voidwriteDanglingIndicesInfo()org.elasticsearch.common.xcontent.NamedXContentRegistryxContentRegistry()
-
Field Details
-
GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING
public static final Setting<org.elasticsearch.common.unit.TimeValue> GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING -
RETENTION_LEASE_SYNC_INTERVAL_SETTING
public static final Setting<org.elasticsearch.common.unit.TimeValue> 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, java.util.function.Function<IndexService,org.elasticsearch.common.CheckedFunction<org.apache.lucene.index.DirectoryReader,org.apache.lucene.index.DirectoryReader,java.io.IOException>> wrapperFactory, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, java.util.List<SearchOperationListener> searchOperationListeners, java.util.List<IndexingOperationListener> indexingOperationListeners, NamedWriteableRegistry namedWriteableRegistry, java.util.function.BooleanSupplier idFieldDataEnabled, java.util.function.BooleanSupplier allowExpensiveQueries, IndexNameExpressionResolver expressionResolver, ValuesSourceRegistry valuesSourceRegistry, IndexStorePlugin.RecoveryStateFactory recoveryStateFactory)
-
-
Method Details
-
numberOfShards
public int numberOfShards() -
getIndexEventListener
-
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<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
public java.util.Set<java.lang.Integer> shardIds() -
cache
-
getIndexAnalyzers
-
mapperService
-
xContentRegistry
public org.elasticsearch.common.xcontent.NamedXContentRegistry xContentRegistry() -
similarityService
-
getIndexSortSupplier
public java.util.function.Supplier<org.apache.lucene.search.Sort> getIndexSortSupplier() -
close
public void close(java.lang.String reason, boolean delete) throws java.io.IOException- Throws:
java.io.IOException
-
writeDanglingIndicesInfo
public void writeDanglingIndicesInfo() -
deleteDanglingIndicesInfo
public void deleteDanglingIndicesInfo() -
indexUUID
public java.lang.String indexUUID() -
createShard
public IndexShard createShard(ShardRouting routing, java.util.function.Consumer<ShardId> globalCheckpointSyncer, RetentionLeaseSyncer retentionLeaseSyncer) throws java.io.IOException- Throws:
java.io.IOException
-
removeShard
public void removeShard(int shardId, java.lang.String reason)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
-
newQueryShardContext
public QueryShardContext newQueryShardContext(int shardId, org.apache.lucene.search.IndexSearcher searcher, java.util.function.LongSupplier nowInMillis, java.lang.String clusterAlias)Creates a new QueryShardContext. The context has not types set yet, if types are required set them viaQueryShardContext.setTypes(String...). 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 boolean updateMapping(IndexMetadata currentIndexMetadata, IndexMetadata newIndexMetadata) throws java.io.IOExceptionDescription copied from interface:IndicesClusterStateService.AllocatedIndexChecks if index requires refresh from master.- Specified by:
updateMappingin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>- Throws:
java.io.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
-
getEngineFactory
-
clearCaches
public boolean clearCaches(boolean queryCache, boolean fieldDataCache, java.lang.String... fields)Clears the caches for the given shard id if the shard is still allocated on this node
-