controller.registerHandler(RestRequest.Method.GET, "/{index}/{type}/{id}/_ping", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/{index}/{type}/{id}/_ping", this);
}
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
SinglePingRequest singlePingRequest = new SinglePingRequest(request.param("index"), request.param("type"), request.param("id"));
// no need to have a threaded listener since we just send back a response
singlePingRequest.listenerThreaded(false);
// if we have a local operation, execute it on a thread since we don't spawn
singlePingRequest.operationThreaded(true);
client.admin().cluster().ping(singlePingRequest, new ActionListener<SinglePingResponse>() {
@Override public void onResponse(SinglePingResponse result) {
try {
XContentBuilder generator = RestXContentBuilder.restContentBuilder(request);
generator.startObject().field("ok", true).endObject();