Index creation on Plugin instantiation


I'm experimenting with elasticsearch plugins creation and I'm trying to
create an index (if missing) on plugin startup.

I wanted to ask what is the best place to add the code snippet for code
creation? I have added it at an injected binding with Client as
constructor parameter but i get the following error:

no known master node, scheduling a retry

[2015-05-26 12:03:27,289][ERROR][bootstrap ] {1.4.1}:
Initialization Failed ...

  1. UncategorizedExecutionException[Failed execution]

My guess is that Client is not ready yet to handle index creation requests,
my code snippet is the following:

public class IndexCreator {

private final String indexName;
private final ESLogger LOG;

public IndexCreator(Settings settings, Client client) {
    this.LOG = Loggers.getLogger(getClass(), settings);
    this.indexName = settings.get("", ".metis");
       String indexName = ".metis-registry";
       IndicesExistsResponse resp = 


       if (!resp.isExists()) {


And I add this as binding to my module

public class MyModule extends AbstractModule {

private final Settings settings;

public MyModule(Settings settings) {
    this.settings = Preconditions.checkNotNull(settings);

protected void configure() {


But it produces the overmentioned error, any ideas?



Please update your bookmarks! We have moved to

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit