controller.registerHandler(RestRequest.Method.GET, "/{index}/_ping/replication", this);
controller.registerHandler(RestRequest.Method.GET, "/_cluster/{index}/_ping/replication", this);
}
@Override public void handleRequest(final RestRequest request, final RestChannel channel) {
ReplicationPingRequest replicationPingRequest = new ReplicationPingRequest(RestActions.splitIndices(request.param("index")));
replicationPingRequest.timeout(request.paramAsTime("timeout", ShardReplicationPingRequest.DEFAULT_TIMEOUT));
replicationPingRequest.listenerThreaded(false);
String replicationType = request.param("replication");
if (replicationType != null) {
replicationPingRequest.replicationType(ReplicationType.fromString(replicationType));
}
client.admin().cluster().ping(replicationPingRequest, new ActionListener<ReplicationPingResponse>() {
@Override public void onResponse(ReplicationPingResponse result) {
try {
XContentBuilder builder = RestXContentBuilder.restContentBuilder(request);