Skip to content

Instantly share code, notes, and snippets.

@kimchy
Created January 7, 2011 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimchy/769484 to your computer and use it in GitHub Desktop.
Save kimchy/769484 to your computer and use it in GitHub Desktop.
package org.elasticsearch.benchmark;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.discovery.MasterNotDiscoveredException;
import org.elasticsearch.node.Node;
import static org.elasticsearch.common.settings.ImmutableSettings.*;
import static org.elasticsearch.node.NodeBuilder.*;
/**
* @author kimchy (shay.banon)
*/
public class Main {
public static void main(String[] args) throws InterruptedException {
Node clientNode = nodeBuilder().settings(settingsBuilder().put("path.data", "data_client")).client(true).node();
try {
ClusterHealthResponse clusterHealthResponse = clientNode.client().admin().cluster().prepareHealth().execute().actionGet();
System.out.println("Health: " + clusterHealthResponse.getStatus());
} catch (MasterNotDiscoveredException e) {
System.out.println("No master, this is what should happen...");
}
Node dataNode = nodeBuilder().settings(settingsBuilder().put("path.data", "data_node")).node();
clientNode.client().admin().indices().prepareCreate("test").execute().actionGet();
Thread.sleep(100000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment