23
23
import org .elasticsearch .action .index .IndexResponse ;
24
24
import org .elasticsearch .action .search .SearchRequest ;
25
25
import org .elasticsearch .action .search .SearchResponse ;
26
- import org .elasticsearch .action .search .SearchScrollRequest ;
27
26
import org .elasticsearch .action .support .PlainActionFuture ;
28
27
import org .elasticsearch .aggregations .bucket .adjacency .AdjacencyMatrixAggregationBuilder ;
29
28
import org .elasticsearch .aggregations .bucket .adjacency .ParsedAdjacencyMatrix ;
159
158
import java .io .Closeable ;
160
159
import java .io .IOException ;
161
160
import java .util .ArrayList ;
162
- import java .util .Collections ;
163
161
import java .util .HashMap ;
164
162
import java .util .List ;
165
163
import java .util .Map ;
180
178
* High level REST client that wraps an instance of the low level {@link RestClient} and allows to build requests and read responses. The
181
179
* {@link RestClient} instance is internally built based on the provided {@link RestClientBuilder} and it gets closed automatically when
182
180
* closing the {@link RestHighLevelClient} instance that wraps it.
183
- * <p>
184
- *
185
- * In case an already existing instance of a low-level REST client needs to be provided, this class can be subclassed and the
186
- * {@link #RestHighLevelClient(RestClient, CheckedConsumer, List)} constructor can be used.
187
- * <p>
188
- *
189
- * This class can also be sub-classed to expose additional client methods that make use of endpoints added to Elasticsearch through plugins,
190
- * or to add support for custom response sections, again added to Elasticsearch through plugins.
191
- * <p>
192
- *
193
- * The majority of the methods in this class come in two flavors, a blocking and an asynchronous version (e.g.
194
- * {@link #search(SearchRequest, RequestOptions)} and {@link #searchAsync(SearchRequest, RequestOptions, ActionListener)}, where the later
195
- * takes an implementation of an {@link ActionListener} as an argument that needs to implement methods that handle successful responses and
196
- * failure scenarios. Most of the blocking calls can throw an {@link IOException} or an unchecked {@link ElasticsearchException} in the
197
- * following cases:
198
- *
199
- * <ul>
200
- * <li>an {@link IOException} is usually thrown in case of failing to parse the REST response in the high-level REST client, the request
201
- * times out or similar cases where there is no response coming back from the Elasticsearch server</li>
202
- * <li>an {@link ElasticsearchException} is usually thrown in case where the server returns a 4xx or 5xx error code. The high-level client
203
- * then tries to parse the response body error details into a generic ElasticsearchException and suppresses the original
204
- * {@link ResponseException}</li>
205
- * </ul>
206
181
*
207
182
* @deprecated The High Level Rest Client is deprecated in favor of the
208
183
* <a href="https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/introduction.html">
@@ -216,7 +191,7 @@ public class RestHighLevelClient implements Closeable {
216
191
/**
217
192
* Environment variable determining whether to send the 7.x compatibility header
218
193
*/
219
- public static final String API_VERSIONING_ENV_VARIABLE = "ELASTIC_CLIENT_APIVERSIONING" ;
194
+ private static final String API_VERSIONING_ENV_VARIABLE = "ELASTIC_CLIENT_APIVERSIONING" ;
220
195
221
196
// To be called using performClientRequest and performClientRequestAsync to ensure version compatibility check
222
197
private final RestClient client ;
@@ -227,14 +202,6 @@ public class RestHighLevelClient implements Closeable {
227
202
/** Do not access directly but through getVersionValidationFuture() */
228
203
private volatile ListenableFuture <Optional <String >> versionValidationFuture ;
229
204
230
- /**
231
- * Creates a {@link RestHighLevelClient} given the low level {@link RestClientBuilder} that allows to build the
232
- * {@link RestClient} to be used to perform requests.
233
- */
234
- public RestHighLevelClient (RestClientBuilder restClientBuilder ) {
235
- this (restClientBuilder .build (), RestClient ::close , Collections .emptyList ());
236
- }
237
-
238
205
/**
239
206
* Creates a {@link RestHighLevelClient} given the low level {@link RestClient} that it should use to perform requests and
240
207
* a list of entries that allow to parse custom response sections added to Elasticsearch through plugins.
@@ -331,23 +298,6 @@ public final IndexResponse index(IndexRequest indexRequest, RequestOptions optio
331
298
return performRequestAndParseEntity (indexRequest , RequestConverters ::index , options , IndexResponse ::fromXContent , emptySet ());
332
299
}
333
300
334
- /**
335
- * Executes a search request using the Search API.
336
- * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
337
- * @param searchRequest the request
338
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
339
- * @return the response
340
- */
341
- public final SearchResponse search (SearchRequest searchRequest , RequestOptions options ) throws IOException {
342
- return performRequestAndParseEntity (
343
- searchRequest ,
344
- r -> RequestConverters .search (r , "_search" ),
345
- options ,
346
- SearchResponse ::fromXContent ,
347
- emptySet ()
348
- );
349
- }
350
-
351
301
/**
352
302
* Asynchronously executes a search using the Search API.
353
303
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
@@ -368,27 +318,7 @@ public final Cancellable searchAsync(SearchRequest searchRequest, RequestOptions
368
318
}
369
319
370
320
/**
371
- * Executes a search using the Search Scroll API.
372
- * See <a
373
- * href="https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll">Search
374
- * Scroll API on elastic.co</a>
375
- * @param searchScrollRequest the request
376
- * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
377
- * @return the response
378
- */
379
- public final SearchResponse scroll (SearchScrollRequest searchScrollRequest , RequestOptions options ) throws IOException {
380
- return performRequestAndParseEntity (
381
- searchScrollRequest ,
382
- RequestConverters ::searchScroll ,
383
- options ,
384
- SearchResponse ::fromXContent ,
385
- emptySet ()
386
- );
387
- }
388
-
389
- /**
390
- * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
391
- * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
321
+ * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.
392
322
*/
393
323
@ Deprecated
394
324
private <Req extends ActionRequest , Resp > Resp performRequestAndParseEntity (
@@ -402,8 +332,7 @@ private <Req extends ActionRequest, Resp> Resp performRequestAndParseEntity(
402
332
}
403
333
404
334
/**
405
- * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
406
- * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
335
+ * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.
407
336
*/
408
337
@ Deprecated
409
338
private <Req extends ActionRequest , Resp > Resp performRequest (
@@ -458,8 +387,7 @@ private <Req, Resp> Resp internalPerformRequest(
458
387
}
459
388
460
389
/**
461
- * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
462
- * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
390
+ * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.
463
391
* @return Cancellable instance that may be used to cancel the request
464
392
*/
465
393
@ Deprecated
@@ -482,8 +410,7 @@ private <Req extends ActionRequest, Resp> Cancellable performRequestAsyncAndPars
482
410
}
483
411
484
412
/**
485
- * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
486
- * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
413
+ * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions.
487
414
* @return Cancellable instance that may be used to cancel the request
488
415
*/
489
416
@ Deprecated
0 commit comments