I keep getting org.elasticsearch.indices.IndexMissingException from ActionFuture.actionGet() when I try to search using the java client. It throws the exception below and then hangs; never gets to the next line.
I have tried a numer of things.
-
setting the jvm props at statup with:
-Djgroups.config=tcp -Djgroups.bind_port=9700 -Djgroups.tcpping.initial_hosts=[9700],[9700],[9700] -
putting an elasticsearch.yml file (with the above values) into the directory from which I launch my program.
-
putting in elasticsearch.yml into the launch dir, but commenting out the bind_port and intial_hosts and adding leaving those two to the jvm system props as described in #1 above.
Nothing works. I do find that I always get this error even if I set the ports and hosts to intentionally wrong values - I don't get a connection problem, just the IndexMissingException. So, I don't even know if I'm reaching the host even when I put back in the correct hosts and port. That said, I do know the hosts are up; and I know the index I am looking for is there. I see the index it when I curl a _status GET call.
BTW: I am open to using the TransportClient if that is better; the client will only ever query and post docs; it won't ever host indices. However, I got the idea this is not supported when I saw this in TransportClient.java
// disabled, still having problems with jgroups acting just as client
if (settings.getAsBoolean("discovery.enabled", true) && false) {
modules.add(new TransportClientClusterModule(settings));
}
My java code is below. Thanks in advance for any help you can provide.
public static void main(String[] args) {
Node node = nodeBuilder().client(true).node();
Client client = node.client();
final GetRequest getRequest = Requests.getRequest("foo");
final GetRequest getRequest1 = getRequest.type("mail");
final GetRequest getRequest2 = getRequest1.id("myIdAbc");
GetResponse response = client.get(getRequest2).actionGet(); //this line throws the below stack trace then hangs
Iterator<GetField> itr = response.iterator(); //never gets here
while (itr.hasNext()) {
GetField gf = itr.next();
System.out.println(gf.name() + ":");
for (Object o : gf.values()) {
System.out.println(o.toString());
}
}
node.close();
}
Exception in thread "main" org.elasticsearch.indices.IndexMissingException: [foo] missing
at org.elasticsearch.cluster.metadata.MetaData.concreteIndex(MetaData.java:174)
at org.elasticsearch.action.support.single.TransportSingleOperationAction$AsyncSingleAction.(TransportSingleOperationAction.java:100)
at org.elasticsearch.action.support.single.TransportSingleOperationAction$AsyncSingleAction.(TransportSingleOperationAction.java:81)
at org.elasticsearch.action.support.single.TransportSingleOperationAction.doExecute(TransportSingleOperationAction.java:68)
at org.elasticsearch.action.support.single.TransportSingleOperationAction.doExecute(TransportSingleOperationAction.java:46)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:54)
at org.elasticsearch.action.support.BaseAction.execute(BaseAction.java:43)
at org.elasticsearch.client.node.NodeClient.get(NodeClient.java:127)
at TEST.main(TEST.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)