|
10 | 10 | import org.elasticsearch.action.ActionRequest;
|
11 | 11 | import org.elasticsearch.action.ActionRequestBuilder;
|
12 | 12 | import org.elasticsearch.action.ActionRequestValidationException;
|
13 |
| -import org.elasticsearch.action.ActionResponse; |
14 | 13 | import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
|
15 | 14 | import org.elasticsearch.action.support.ActionFilters;
|
16 | 15 | import org.elasticsearch.action.support.HandledTransportAction;
|
| 16 | +import org.elasticsearch.action.support.master.AcknowledgedResponse; |
17 | 17 | import org.elasticsearch.client.Client;
|
18 | 18 | import org.elasticsearch.client.ElasticsearchClient;
|
19 | 19 | import org.elasticsearch.cluster.metadata.IndexMetaData;
|
@@ -81,13 +81,32 @@ public void writeTo(StreamOutput out) throws IOException {
|
81 | 81 | }
|
82 | 82 | }
|
83 | 83 |
|
84 |
| - public static class Response extends ActionResponse { |
| 84 | + public static class Response extends AcknowledgedResponse { |
| 85 | + |
| 86 | + Response(boolean acknowledged) { |
| 87 | + super(acknowledged); |
| 88 | + } |
| 89 | + |
| 90 | + Response() { |
| 91 | + } |
| 92 | + |
| 93 | + @Override |
| 94 | + public void readFrom(StreamInput in) throws IOException { |
| 95 | + super.readFrom(in); |
| 96 | + readAcknowledged(in); |
| 97 | + } |
| 98 | + |
| 99 | + @Override |
| 100 | + public void writeTo(StreamOutput out) throws IOException { |
| 101 | + super.writeTo(out); |
| 102 | + writeAcknowledged(out); |
| 103 | + } |
85 | 104 |
|
86 | 105 | }
|
87 | 106 |
|
88 | 107 | public static class RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder> {
|
89 | 108 |
|
90 |
| - public RequestBuilder(ElasticsearchClient client) { |
| 109 | + RequestBuilder(ElasticsearchClient client) { |
91 | 110 | super(client, INSTANCE, new Request());
|
92 | 111 | }
|
93 | 112 | }
|
@@ -147,7 +166,7 @@ void finalizeResponse() {
|
147 | 166 |
|
148 | 167 | if (error == null) {
|
149 | 168 | // include task ids?
|
150 |
| - listener.onResponse(new Response()); |
| 169 | + listener.onResponse(new Response(true)); |
151 | 170 | } else {
|
152 | 171 | // TODO: cancel all started tasks
|
153 | 172 | listener.onFailure(error);
|
|
0 commit comments