public interface IndexEventListener
IndexModule.addIndexEventListener(IndexEventListener)
. All listeners have the same
lifecycle as the IndexService
they are created for.
An IndexEventListener can be used across multiple indices and shards since all callback methods receive sufficient local state via their arguments. Yet, if an instance is shared across indices they might be called concurrently and should not modify local state without sufficient synchronization.
Modifier and Type | Method and Description |
---|---|
default void |
afterIndexCreated(IndexService indexService)
Called after the index has been created.
|
default void |
afterIndexRemoved(Index index,
IndexSettings indexSettings,
IndicesClusterStateService.AllocatedIndices.IndexRemovalReason reason)
Called after the index has been removed.
|
default void |
afterIndexShardClosed(ShardId shardId,
IndexShard indexShard,
Settings indexSettings)
Called after the index shard has been closed.
|
default void |
afterIndexShardCreated(IndexShard indexShard)
Called after the index shard has been created.
|
default void |
afterIndexShardDeleted(ShardId shardId,
Settings indexSettings)
Called after the index shard has been deleted from disk.
|
default void |
afterIndexShardStarted(IndexShard indexShard)
Called after the index shard has been started.
|
default void |
beforeIndexAddedToCluster(Index index,
Settings indexSettings)
Called on the Master node only before the
IndexService instances is created to simulate an index creation. |
default void |
beforeIndexCreated(Index index,
Settings indexSettings)
Called before the index gets created.
|
default void |
beforeIndexRemoved(IndexService indexService,
IndicesClusterStateService.AllocatedIndices.IndexRemovalReason reason)
Called before the index get closed.
|
default void |
beforeIndexShardClosed(ShardId shardId,
IndexShard indexShard,
Settings indexSettings)
Called before the index shard gets closed.
|
default void |
beforeIndexShardCreated(ShardId shardId,
Settings indexSettings)
Called before the index shard gets created.
|
default void |
beforeIndexShardDeleted(ShardId shardId,
Settings indexSettings)
Called before the index shard gets deleted from disk
Note: this method is only executed on the first attempt of deleting the shard.
|
default void |
indexShardStateChanged(IndexShard indexShard,
IndexShardState previousState,
IndexShardState currentState,
java.lang.String reason)
Called after a shard's
IndexShardState changes. |
default void |
onShardInactive(IndexShard indexShard)
Called when a shard is marked as inactive
|
default void |
onStoreClosed(ShardId shardId)
Called when the given shards store is closed.
|
default void |
shardRoutingChanged(IndexShard indexShard,
ShardRouting oldRouting,
ShardRouting newRouting)
Called when the shard routing has changed state.
|
default void shardRoutingChanged(IndexShard indexShard, @Nullable ShardRouting oldRouting, ShardRouting newRouting)
indexShard
- The index shardoldRouting
- The old routing state (can be null)newRouting
- The new routing statedefault void afterIndexShardCreated(IndexShard indexShard)
default void afterIndexShardStarted(IndexShard indexShard)
default void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard, Settings indexSettings)
indexShard
- The index sharddefault void afterIndexShardClosed(ShardId shardId, @Nullable IndexShard indexShard, Settings indexSettings)
shardId
- The shard iddefault void indexShardStateChanged(IndexShard indexShard, @Nullable IndexShardState previousState, IndexShardState currentState, @Nullable java.lang.String reason)
IndexShardState
changes.
The order of concurrent events is preserved. The execution must be lightweight.indexShard
- the shard the new state was applied topreviousState
- the previous index shard state if there was one, null otherwisecurrentState
- the new shard statereason
- the reason for the state change if there is one, null otherwisedefault void onShardInactive(IndexShard indexShard)
indexShard
- The shard that was marked inactivedefault void beforeIndexCreated(Index index, Settings indexSettings)
default void afterIndexCreated(IndexService indexService)
default void beforeIndexRemoved(IndexService indexService, IndicesClusterStateService.AllocatedIndices.IndexRemovalReason reason)
indexService
- The index servicereason
- the reason for index removaldefault void afterIndexRemoved(Index index, IndexSettings indexSettings, IndicesClusterStateService.AllocatedIndices.IndexRemovalReason reason)
index
- The indexreason
- the reason for index removaldefault void beforeIndexShardCreated(ShardId shardId, Settings indexSettings)
default void beforeIndexShardDeleted(ShardId shardId, Settings indexSettings)
shardId
- The shard idindexSettings
- the shards index settingsdefault void afterIndexShardDeleted(ShardId shardId, Settings indexSettings)
shardId
- The shard idindexSettings
- the shards index settingsdefault void beforeIndexAddedToCluster(Index index, Settings indexSettings)
IndexService
instances is created to simulate an index creation.
This happens right before the index and it's metadata is registered in the cluster statedefault void onStoreClosed(ShardId shardId)
shardId
- the shard ID the store belongs to