NodeClient and org.elasticsearch.cluster.ClusterStateListener


(Baruch Brutman) #1

Hi,

We are doing a rolling index and would like to know on the NodeClient that the new index has been added. Is it possible to listen to an event that would indicate a new index creation?

Thanks!


(Jason Tedor) #2

Yes, you can create a ClusterStateObserver with a ChangePredicate that encodes that the indices have changed. For the apply override that accepts two cluster states you have to compare ClusterState#metaData#indices and for the apply override that accepts a ClusterChangedEvent you can just inspect ClusterChangedEvent#indicesCreated.


(Baruch Brutman) #3

Thanks for the prompt and useful reply!


(system) #4