Skip to content

Commit b062ce5

Browse files
authored
Client: Deprecate many argument performRequest (#30315)
Deprecate the many arguments versions of `performRequest` and `performRequestAsync` in favor of the `Request` object flavored variants introduced in #29623. We'll be dropping the many arguments variants in 7.0 because they make it difficult to add new features in a backwards compatible way and they create a *ton* of intellisense noise.
1 parent d20e8e2 commit b062ce5

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

client/rest/src/main/java/org/elasticsearch/client/RestClient.java

+16
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ public void performRequestAsync(Request request, ResponseListener responseListen
210210
* @throws IOException in case of a problem or the connection was aborted
211211
* @throws ClientProtocolException in case of an http protocol error
212212
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
213+
* @deprecated prefer {@link #performRequest(Request)}
213214
*/
215+
@Deprecated
214216
public Response performRequest(String method, String endpoint, Header... headers) throws IOException {
215217
Request request = new Request(method, endpoint);
216218
request.setHeaders(headers);
@@ -229,7 +231,9 @@ public Response performRequest(String method, String endpoint, Header... headers
229231
* @throws IOException in case of a problem or the connection was aborted
230232
* @throws ClientProtocolException in case of an http protocol error
231233
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
234+
* @deprecated prefer {@link #performRequest(Request)}
232235
*/
236+
@Deprecated
233237
public Response performRequest(String method, String endpoint, Map<String, String> params, Header... headers) throws IOException {
234238
Request request = new Request(method, endpoint);
235239
addParameters(request, params);
@@ -252,7 +256,9 @@ public Response performRequest(String method, String endpoint, Map<String, Strin
252256
* @throws IOException in case of a problem or the connection was aborted
253257
* @throws ClientProtocolException in case of an http protocol error
254258
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
259+
* @deprecated prefer {@link #performRequest(Request)}
255260
*/
261+
@Deprecated
256262
public Response performRequest(String method, String endpoint, Map<String, String> params,
257263
HttpEntity entity, Header... headers) throws IOException {
258264
Request request = new Request(method, endpoint);
@@ -289,7 +295,9 @@ public Response performRequest(String method, String endpoint, Map<String, Strin
289295
* @throws IOException in case of a problem or the connection was aborted
290296
* @throws ClientProtocolException in case of an http protocol error
291297
* @throws ResponseException in case Elasticsearch responded with a status code that indicated an error
298+
* @deprecated prefer {@link #performRequest(Request)}
292299
*/
300+
@Deprecated
293301
public Response performRequest(String method, String endpoint, Map<String, String> params,
294302
HttpEntity entity, HttpAsyncResponseConsumerFactory httpAsyncResponseConsumerFactory,
295303
Header... headers) throws IOException {
@@ -310,7 +318,9 @@ public Response performRequest(String method, String endpoint, Map<String, Strin
310318
* @param endpoint the path of the request (without host and port)
311319
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
312320
* @param headers the optional request headers
321+
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
313322
*/
323+
@Deprecated
314324
public void performRequestAsync(String method, String endpoint, ResponseListener responseListener, Header... headers) {
315325
Request request;
316326
try {
@@ -333,7 +343,9 @@ public void performRequestAsync(String method, String endpoint, ResponseListener
333343
* @param params the query_string parameters
334344
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
335345
* @param headers the optional request headers
346+
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
336347
*/
348+
@Deprecated
337349
public void performRequestAsync(String method, String endpoint, Map<String, String> params,
338350
ResponseListener responseListener, Header... headers) {
339351
Request request;
@@ -361,7 +373,9 @@ public void performRequestAsync(String method, String endpoint, Map<String, Stri
361373
* @param entity the body of the request, null if not applicable
362374
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
363375
* @param headers the optional request headers
376+
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
364377
*/
378+
@Deprecated
365379
public void performRequestAsync(String method, String endpoint, Map<String, String> params,
366380
HttpEntity entity, ResponseListener responseListener, Header... headers) {
367381
Request request;
@@ -394,7 +408,9 @@ public void performRequestAsync(String method, String endpoint, Map<String, Stri
394408
* connection on the client side.
395409
* @param responseListener the {@link ResponseListener} to notify when the request is completed or fails
396410
* @param headers the optional request headers
411+
* @deprecated prefer {@link #performRequestAsync(Request, ResponseListener)}
397412
*/
413+
@Deprecated
398414
public void performRequestAsync(String method, String endpoint, Map<String, String> params,
399415
HttpEntity entity, HttpAsyncResponseConsumerFactory httpAsyncResponseConsumerFactory,
400416
ResponseListener responseListener, Header... headers) {

docs/CHANGELOG.asciidoc

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
[partintro]
55
--
6-
// To add a release, copy and paste the template text
6+
// To add a release, copy and paste the template text
77
// and add a link to the new section. Note that release subheads must
88
// be floated and sections cannot be empty.
99

@@ -139,8 +139,11 @@ coming[6.4.0]
139139
//[float]
140140
//=== Breaking Java Changes
141141

142-
//[float]
143-
//=== Deprecations
142+
[float]
143+
=== Deprecations
144+
145+
Deprecated multi-argument versions of the request methods in the RestClient.
146+
Prefer the "Request" object flavored methods. ({pull}30315[#30315])
144147

145148
[float]
146149
=== New Features
@@ -157,8 +160,8 @@ analysis module. ({pull}30397[#30397])
157160

158161
{ref-64}/breaking_64_api_changes.html#copy-source-settings-on-resize[Allow copying source settings on index resize operations] ({pull}30255[#30255])
159162

160-
Added new "Request" object flavored request methods. Prefer these instead of the
161-
multi-argument versions. ({pull}29623[#29623])
163+
Added new "Request" object flavored request methods in the RestClient. Prefer
164+
these instead of the multi-argument versions. ({pull}29623[#29623])
162165

163166
The cluster state listener to decide if watcher should be
164167
stopped/started/paused now runs far less code in an executor but is more

0 commit comments

Comments
 (0)