Created
December 5, 2012 11:50
-
-
Save martijnvg/4214961 to your computer and use it in GitHub Desktop.
Show all indices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.elasticsearch.action.admin.indices.status.IndicesStatusResponse; | |
import org.elasticsearch.client.Client; | |
import org.elasticsearch.common.metrics.CounterMetric; | |
import org.elasticsearch.index.field.data.FieldData; | |
import org.elasticsearch.index.field.data.ints.SingleValueIntFieldData; | |
import org.elasticsearch.node.Node; | |
import org.elasticsearch.node.NodeBuilder; | |
/** | |
*/ | |
public class Testje { | |
public static void main(String[] args) { | |
Node node = NodeBuilder.nodeBuilder().node(); | |
node.start(); | |
Client client = node.client(); | |
client.admin().indices().prepareCreate("test1").execute().actionGet(); | |
client.admin().indices().prepareCreate("test2").execute().actionGet(); | |
client.admin().indices().prepareCreate("test3").execute().actionGet(); | |
IndicesStatusResponse response = client.admin().indices().prepareStatus().execute().actionGet(); | |
for (String index : response.indices().keySet()) { | |
System.out.println(index); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment