I am getting nonodesavailableexception with this code:
String query = "{\"phone\":\"111\"}";
User user = new User("222",null,null);
SearchOperation searchOp = new SearchOperation.Builder(BinaryValue.create(INDEX),jsonUtils.covertFromObjectToJson(user)).build();
RiakCluster cluster = RiakClient.newClient(8087, "127.0.0.1").getRiakCluster();
RiakFuture<com.basho.riak.client.core.operations.SearchOperation.Response,BinaryValue> riakFuture = cluster.execute(searchOp);
com.basho.riak.client.core.operations.SearchOperation.Response response = searchOp.get(); //Getting error in this line.
String queryString = searchOp.getQueryInfo().toString();
Although this is a shot in the dark,
NoNodesAvailableExceptionseems to imply that your error is client side and that it's throwing an exception because there are no nodes available.I am afraid that I have little experience in troubleshooting the clients for Riak but I can tell you what I would do in this situation.
riak pingand see if it returnspongto confirm it's there. If so, runriak-admin wait-for-service riak_kvand wait until it confirms thatriak_kv is upcurl -v http://127.0.0.1:8098/stats -H "Accept: text/plain"and have it return a list of stats about your Riak install.curl. See https://www.tiot.jp/riak-docs/riak/kv/2.9.0p5/developing/usage/search/ for a set of search related examples to get you started. Once you have confirmed your query works incurl, you can then look carefully at the query you posted here to see whether it matches up with your curl query and adjust accordingly if not.Based on how far you get through the above 3 point list before something goes wrong, you should be able to locate the source of your issue and focus your efforts on that either by yourself or by posting a new question here.