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 interfaceIndexService.ShardStoreDeleter
-
Field Summary
Fields Modifier and Type Field Description static Setting<TimeValue>GLOBAL_CHECKPOINT_SYNC_INTERVAL_SETTING-
Fields inherited from class org.elasticsearch.index.AbstractIndexComponent
deprecationLogger, logger
-
-
Constructor Summary
Constructors Constructor Description IndexService(IndexSettings indexSettings, NodeEnvironment nodeEnv, NamedXContentRegistry xContentRegistry, SimilarityService similarityService, IndexService.ShardStoreDeleter shardStoreDeleter, AnalysisRegistry registry, EngineFactory engineFactory, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ScriptService scriptService, Client client, QueryCache queryCache, IndexStore indexStore, IndexEventListener eventListener, IndexModule.IndexSearcherWrapperFactory wrapperFactory, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, java.util.List<SearchOperationListener> searchOperationListeners, java.util.List<IndexingOperationListener> indexingOperationListeners, NamedWriteableRegistry namedWriteableRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)IndexShardcreateShard(ShardRouting routing, java.util.function.Consumer<ShardId> globalCheckpointSyncer)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.index.IndexReader indexReader, 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 indexMetaData)Checks if index requires refresh from master.voidupdateMetaData(IndexMetaData metadata)Updates the meta data of this index.NamedXContentRegistryxContentRegistry()-
Methods inherited from class org.elasticsearch.index.AbstractIndexComponent
index
-
Methods inherited from interface org.elasticsearch.index.IndexComponent
index
-
-
-
-
Constructor Detail
-
IndexService
public IndexService(IndexSettings indexSettings, NodeEnvironment nodeEnv, NamedXContentRegistry xContentRegistry, SimilarityService similarityService, IndexService.ShardStoreDeleter shardStoreDeleter, AnalysisRegistry registry, EngineFactory engineFactory, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ScriptService scriptService, Client client, QueryCache queryCache, IndexStore indexStore, IndexEventListener eventListener, IndexModule.IndexSearcherWrapperFactory wrapperFactory, MapperRegistry mapperRegistry, IndicesFieldDataCache indicesFieldDataCache, java.util.List<SearchOperationListener> searchOperationListeners, java.util.List<IndexingOperationListener> indexingOperationListeners, NamedWriteableRegistry namedWriteableRegistry) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
numberOfShards
public int numberOfShards()
-
getIndexEventListener
public IndexEventListener getIndexEventListener()
-
iterator
public java.util.Iterator<IndexShard> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<IndexShard>
-
hasShard
public boolean hasShard(int shardId)
-
getShardOrNull
@Nullable public IndexShard getShardOrNull(int shardId)
Return the shard with the provided id, or null if there is no such shard.- Specified by:
getShardOrNullin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
-
getShard
public IndexShard getShard(int shardId)
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
public IndexCache cache()
-
getIndexAnalyzers
public IndexAnalyzers getIndexAnalyzers()
-
mapperService
public MapperService mapperService()
-
xContentRegistry
public NamedXContentRegistry xContentRegistry()
-
similarityService
public SimilarityService 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
-
indexUUID
public java.lang.String indexUUID()
-
createShard
public IndexShard createShard(ShardRouting routing, java.util.function.Consumer<ShardId> globalCheckpointSyncer) 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>
-
getIndexSettings
public IndexSettings 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.index.IndexReader indexReader, 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 anullIndexReaderwill return a valid context, however it won't be able to makeIndexReader-specific optimizations, such as rewriting containing range queries.
-
getThreadPool
public ThreadPool getThreadPool()
TheThreadPoolto use for this index.
-
getScriptService
public ScriptService getScriptService()
TheScriptServiceto use for this index.
-
updateMapping
public boolean updateMapping(IndexMetaData indexMetaData) throws java.io.IOException
Description copied from interface:IndicesClusterStateService.AllocatedIndexChecks if index requires refresh from master.- Specified by:
updateMappingin interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>- Throws:
java.io.IOException
-
getMetaData
public IndexMetaData getMetaData()
-
updateMetaData
public void updateMetaData(IndexMetaData metadata)
Description copied from interface:IndicesClusterStateService.AllocatedIndexUpdates the meta data of this index. Changes become visible throughIndicesClusterStateService.AllocatedIndex.getIndexSettings()- Specified by:
updateMetaDatain interfaceIndicesClusterStateService.AllocatedIndex<IndexShard>
-
getEngineFactory
public final EngineFactory 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
-
-