Răsfoiți Sursa

Remove unused methods and classes from HLRC (#92030)

Joe Gallo 2 ani în urmă
părinte
comite
2b8fde6890
17 a modificat fișierele cu 0 adăugiri și 2928 ștergeri
  1. 0 337
      client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java
  2. 0 471
      client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java
  3. 0 66
      client/rest-high-level/src/main/java/org/elasticsearch/client/RethrottleRequest.java
  4. 0 72
      client/rest-high-level/src/main/java/org/elasticsearch/client/cluster/ProxyModeInfo.java
  5. 0 127
      client/rest-high-level/src/main/java/org/elasticsearch/client/cluster/RemoteConnectionInfo.java
  6. 0 65
      client/rest-high-level/src/main/java/org/elasticsearch/client/cluster/SniffModeInfo.java
  7. 0 174
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/BroadcastResponse.java
  8. 0 249
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountRequest.java
  9. 0 230
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountResponse.java
  10. 0 115
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/GetSourceRequest.java
  11. 0 36
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/GetSourceResponse.java
  12. 0 13
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainRequest.java
  13. 0 66
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsRequest.java
  14. 0 66
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsResponse.java
  15. 0 89
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/PageParams.java
  16. 0 284
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsRequest.java
  17. 0 468
      client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java

+ 0 - 337
client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java

@@ -9,9 +9,6 @@
 package org.elasticsearch.client;
 
 import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpHead;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
 import org.apache.http.entity.ContentType;
@@ -19,41 +16,26 @@ import org.apache.http.nio.entity.NByteArrayEntity;
 import org.apache.lucene.util.BytesRef;
 import org.elasticsearch.action.DocWriteRequest;
 import org.elasticsearch.action.bulk.BulkRequest;
-import org.elasticsearch.action.delete.DeleteRequest;
-import org.elasticsearch.action.explain.ExplainRequest;
-import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
-import org.elasticsearch.action.get.GetRequest;
-import org.elasticsearch.action.get.MultiGetRequest;
 import org.elasticsearch.action.index.IndexRequest;
-import org.elasticsearch.action.search.MultiSearchRequest;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchScrollRequest;
 import org.elasticsearch.action.support.ActiveShardCount;
 import org.elasticsearch.action.support.IndicesOptions;
 import org.elasticsearch.action.support.WriteRequest.RefreshPolicy;
 import org.elasticsearch.action.update.UpdateRequest;
-import org.elasticsearch.client.core.CountRequest;
-import org.elasticsearch.client.core.GetSourceRequest;
-import org.elasticsearch.client.core.TermVectorsRequest;
-import org.elasticsearch.client.internal.Requests;
 import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.bytes.BytesReference;
 import org.elasticsearch.common.lucene.uid.Versions;
-import org.elasticsearch.common.util.CollectionUtils;
 import org.elasticsearch.common.xcontent.XContentHelper;
 import org.elasticsearch.core.Nullable;
 import org.elasticsearch.core.SuppressForbidden;
 import org.elasticsearch.core.TimeValue;
 import org.elasticsearch.index.VersionType;
-import org.elasticsearch.index.reindex.AbstractBulkByScrollRequest;
-import org.elasticsearch.index.reindex.ReindexRequest;
 import org.elasticsearch.index.seqno.SequenceNumbers;
 import org.elasticsearch.rest.action.search.RestSearchAction;
-import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
 import org.elasticsearch.xcontent.DeprecationHandler;
 import org.elasticsearch.xcontent.NamedXContentRegistry;
 import org.elasticsearch.xcontent.ToXContent;
-import org.elasticsearch.xcontent.XContent;
 import org.elasticsearch.xcontent.XContentBuilder;
 import org.elasticsearch.xcontent.XContentParser;
 import org.elasticsearch.xcontent.XContentType;
@@ -75,27 +57,6 @@ final class RequestConverters {
         // Contains only status utility methods
     }
 
-    static Request delete(DeleteRequest deleteRequest) {
-        String endpoint = endpoint(deleteRequest.index(), deleteRequest.id());
-        Request request = new Request(HttpDelete.METHOD_NAME, endpoint);
-
-        Params parameters = new Params();
-        parameters.withRouting(deleteRequest.routing());
-        parameters.withTimeout(deleteRequest.timeout());
-        parameters.withVersion(deleteRequest.version());
-        parameters.withVersionType(deleteRequest.versionType());
-        parameters.withIfSeqNo(deleteRequest.ifSeqNo());
-        parameters.withIfPrimaryTerm(deleteRequest.ifPrimaryTerm());
-        parameters.withRefreshPolicy(deleteRequest.getRefreshPolicy());
-        parameters.withWaitForActiveShards(deleteRequest.waitForActiveShards());
-        request.addParameters(parameters.asMap());
-        return request;
-    }
-
-    static Request info() {
-        return new Request(HttpGet.METHOD_NAME, "/");
-    }
-
     static Request bulk(BulkRequest bulkRequest) throws IOException {
         Request request = new Request(HttpPost.METHOD_NAME, "/_bulk");
 
@@ -229,64 +190,6 @@ final class RequestConverters {
         return request;
     }
 
-    static Request exists(GetRequest getRequest) {
-        return getStyleRequest(HttpHead.METHOD_NAME, getRequest);
-    }
-
-    static Request get(GetRequest getRequest) {
-        return getStyleRequest(HttpGet.METHOD_NAME, getRequest);
-    }
-
-    private static Request getStyleRequest(String method, GetRequest getRequest) {
-        Request request = new Request(method, endpoint(getRequest.index(), getRequest.id()));
-
-        Params parameters = new Params();
-        parameters.withPreference(getRequest.preference());
-        parameters.withRouting(getRequest.routing());
-        parameters.withRefresh(getRequest.refresh());
-        parameters.withRealtime(getRequest.realtime());
-        parameters.withStoredFields(getRequest.storedFields());
-        parameters.withVersion(getRequest.version());
-        parameters.withVersionType(getRequest.versionType());
-        parameters.withFetchSourceContext(getRequest.fetchSourceContext());
-        request.addParameters(parameters.asMap());
-        return request;
-    }
-
-    static Request sourceExists(GetSourceRequest getSourceRequest) {
-        return sourceRequest(getSourceRequest, HttpHead.METHOD_NAME);
-    }
-
-    static Request getSource(GetSourceRequest getSourceRequest) {
-        return sourceRequest(getSourceRequest, HttpGet.METHOD_NAME);
-    }
-
-    private static Request sourceRequest(GetSourceRequest getSourceRequest, String httpMethodName) {
-        Params parameters = new Params();
-        parameters.withPreference(getSourceRequest.preference());
-        parameters.withRouting(getSourceRequest.routing());
-        parameters.withRefresh(getSourceRequest.refresh());
-        parameters.withRealtime(getSourceRequest.realtime());
-        parameters.withFetchSourceContext(getSourceRequest.fetchSourceContext());
-
-        String endpoint = endpoint(getSourceRequest.index(), "_source", getSourceRequest.id());
-        Request request = new Request(httpMethodName, endpoint);
-        request.addParameters(parameters.asMap());
-        return request;
-    }
-
-    static Request multiGet(MultiGetRequest multiGetRequest) throws IOException {
-        Request request = new Request(HttpPost.METHOD_NAME, "/_mget");
-
-        Params parameters = new Params();
-        parameters.withPreference(multiGetRequest.preference());
-        parameters.withRealtime(multiGetRequest.realtime());
-        parameters.withRefresh(multiGetRequest.refresh());
-        request.addParameters(parameters.asMap());
-        request.setEntity(createEntity(multiGetRequest, REQUEST_BODY_CONTENT_TYPE));
-        return request;
-    }
-
     static Request index(IndexRequest indexRequest) {
         String method = Strings.hasLength(indexRequest.id()) ? HttpPut.METHOD_NAME : HttpPost.METHOD_NAME;
 
@@ -318,53 +221,6 @@ final class RequestConverters {
         return request;
     }
 
-    static Request update(UpdateRequest updateRequest) throws IOException {
-        String endpoint = endpoint(updateRequest.index(), "_update", updateRequest.id());
-        Request request = new Request(HttpPost.METHOD_NAME, endpoint);
-
-        Params parameters = new Params();
-        parameters.withRouting(updateRequest.routing());
-        parameters.withTimeout(updateRequest.timeout());
-        parameters.withRefreshPolicy(updateRequest.getRefreshPolicy());
-        parameters.withWaitForActiveShards(updateRequest.waitForActiveShards());
-        parameters.withDocAsUpsert(updateRequest.docAsUpsert());
-        parameters.withFetchSourceContext(updateRequest.fetchSource());
-        parameters.withRetryOnConflict(updateRequest.retryOnConflict());
-        parameters.withVersion(updateRequest.version());
-        parameters.withVersionType(updateRequest.versionType());
-        parameters.withRequireAlias(updateRequest.isRequireAlias());
-
-        // The Java API allows update requests with different content types
-        // set for the partial document and the upsert document. This client
-        // only accepts update requests that have the same content types set
-        // for both doc and upsert.
-        XContentType xContentType = null;
-        if (updateRequest.doc() != null) {
-            xContentType = updateRequest.doc().getContentType();
-        }
-        if (updateRequest.upsertRequest() != null) {
-            XContentType upsertContentType = updateRequest.upsertRequest().getContentType();
-            if ((xContentType != null) && (xContentType != upsertContentType)) {
-                throw new IllegalStateException(
-                    "Update request cannot have different content types for doc ["
-                        + xContentType
-                        + "]"
-                        + " and upsert ["
-                        + upsertContentType
-                        + "] documents"
-                );
-            } else {
-                xContentType = upsertContentType;
-            }
-        }
-        if (xContentType == null) {
-            xContentType = Requests.INDEX_CONTENT_TYPE;
-        }
-        request.addParameters(parameters.asMap());
-        request.setEntity(createEntity(updateRequest, xContentType));
-        return request;
-    }
-
     /**
      * Convert a {@linkplain SearchRequest} into a {@linkplain Request}.
      * @param searchRequest the request to convert
@@ -418,116 +274,6 @@ final class RequestConverters {
         return request;
     }
 
-    static Request multiSearch(MultiSearchRequest multiSearchRequest) throws IOException {
-        Request request = new Request(HttpPost.METHOD_NAME, "/_msearch");
-
-        Params params = new Params();
-        params.putParam(RestSearchAction.TYPED_KEYS_PARAM, "true");
-        if (multiSearchRequest.maxConcurrentSearchRequests() != MultiSearchRequest.MAX_CONCURRENT_SEARCH_REQUESTS_DEFAULT) {
-            params.putParam("max_concurrent_searches", Integer.toString(multiSearchRequest.maxConcurrentSearchRequests()));
-        }
-
-        XContent xContent = REQUEST_BODY_CONTENT_TYPE.xContent();
-        byte[] source = MultiSearchRequest.writeMultiLineFormat(multiSearchRequest, xContent);
-        request.addParameters(params.asMap());
-        request.setEntity(new NByteArrayEntity(source, createContentType(xContent.type())));
-        return request;
-    }
-
-    static Request count(CountRequest countRequest) throws IOException {
-        Request request = new Request(HttpPost.METHOD_NAME, endpoint(countRequest.indices(), countRequest.types(), "_count"));
-        Params params = new Params();
-        params.withRouting(countRequest.routing());
-        params.withPreference(countRequest.preference());
-        params.withIndicesOptions(countRequest.indicesOptions());
-        if (countRequest.terminateAfter() != 0) {
-            params.withTerminateAfter(countRequest.terminateAfter());
-        }
-        if (countRequest.minScore() != null) {
-            params.putParam("min_score", String.valueOf(countRequest.minScore()));
-        }
-        request.addParameters(params.asMap());
-        request.setEntity(createEntity(countRequest, REQUEST_BODY_CONTENT_TYPE));
-        return request;
-    }
-
-    static Request explain(ExplainRequest explainRequest) throws IOException {
-        String endpoint = endpoint(explainRequest.index(), "_explain", explainRequest.id());
-        Request request = new Request(HttpGet.METHOD_NAME, endpoint);
-
-        Params params = new Params();
-        params.withStoredFields(explainRequest.storedFields());
-        params.withFetchSourceContext(explainRequest.fetchSourceContext());
-        params.withRouting(explainRequest.routing());
-        params.withPreference(explainRequest.preference());
-        request.addParameters(params.asMap());
-        request.setEntity(createEntity(explainRequest, REQUEST_BODY_CONTENT_TYPE));
-        return request;
-    }
-
-    static Request fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest) throws IOException {
-        String methodName = fieldCapabilitiesRequest.indexFilter() != null ? HttpPost.METHOD_NAME : HttpGet.METHOD_NAME;
-        Request request = new Request(methodName, endpoint(fieldCapabilitiesRequest.indices(), "_field_caps"));
-
-        Params params = new Params();
-        params.withFields(fieldCapabilitiesRequest.fields());
-        if (FieldCapabilitiesRequest.DEFAULT_INDICES_OPTIONS.equals(fieldCapabilitiesRequest.indicesOptions()) == false) {
-            params.withIndicesOptions(fieldCapabilitiesRequest.indicesOptions());
-        }
-        request.addParameters(params.asMap());
-        if (fieldCapabilitiesRequest.indexFilter() != null) {
-            request.setEntity(createEntity(fieldCapabilitiesRequest, REQUEST_BODY_CONTENT_TYPE));
-        }
-        return request;
-    }
-
-    static Request reindex(ReindexRequest reindexRequest) throws IOException {
-        return prepareReindexRequest(reindexRequest, true);
-    }
-
-    private static Request prepareReindexRequest(ReindexRequest reindexRequest, boolean waitForCompletion) throws IOException {
-        String endpoint = new EndpointBuilder().addPathPart("_reindex").build();
-        Request request = new Request(HttpPost.METHOD_NAME, endpoint);
-        Params params = new Params().withWaitForCompletion(waitForCompletion)
-            .withRefresh(reindexRequest.isRefresh())
-            .withTimeout(reindexRequest.getTimeout())
-            .withWaitForActiveShards(reindexRequest.getWaitForActiveShards())
-            .withRequestsPerSecond(reindexRequest.getRequestsPerSecond())
-            .withSlices(reindexRequest.getSlices())
-            .withRequireAlias(reindexRequest.getDestination().isRequireAlias());
-
-        if (reindexRequest.getScrollTime() != null) {
-            params.putParam("scroll", reindexRequest.getScrollTime());
-        }
-
-        request.addParameters(params.asMap());
-        request.setEntity(createEntity(reindexRequest, REQUEST_BODY_CONTENT_TYPE));
-        return request;
-    }
-
-    static Request termVectors(TermVectorsRequest tvrequest) throws IOException {
-        String endpoint;
-        if (tvrequest.getType() != null) {
-            endpoint = new EndpointBuilder().addPathPart(tvrequest.getIndex(), tvrequest.getType(), tvrequest.getId())
-                .addPathPartAsIs("_termvectors")
-                .build();
-        } else {
-            endpoint = new EndpointBuilder().addPathPart(tvrequest.getIndex())
-                .addPathPartAsIs("_termvectors")
-                .addPathPart(tvrequest.getId())
-                .build();
-        }
-
-        Request request = new Request(HttpGet.METHOD_NAME, endpoint);
-        Params params = new Params();
-        params.withRouting(tvrequest.getRouting());
-        params.withPreference(tvrequest.getPreference());
-        params.withRealtime(tvrequest.getRealtime());
-        request.addParameters(params.asMap());
-        request.setEntity(createEntity(tvrequest, REQUEST_BODY_CONTENT_TYPE));
-        return request;
-    }
-
     static HttpEntity createEntity(ToXContent toXContent, XContentType xContentType) throws IOException {
         return createEntity(toXContent, xContentType, ToXContent.EMPTY_PARAMS);
     }
@@ -607,35 +353,6 @@ final class RequestConverters {
             return parameters;
         }
 
-        Params withDocAsUpsert(boolean docAsUpsert) {
-            if (docAsUpsert) {
-                return putParam("doc_as_upsert", Boolean.TRUE.toString());
-            }
-            return this;
-        }
-
-        Params withFetchSourceContext(FetchSourceContext fetchSourceContext) {
-            if (fetchSourceContext != null) {
-                if (fetchSourceContext.fetchSource() == false) {
-                    putParam("_source", Boolean.FALSE.toString());
-                }
-                if (CollectionUtils.isEmpty(fetchSourceContext.includes()) == false) {
-                    putParam("_source_includes", String.join(",", fetchSourceContext.includes()));
-                }
-                if (CollectionUtils.isEmpty(fetchSourceContext.excludes()) == false) {
-                    putParam("_source_excludes", String.join(",", fetchSourceContext.excludes()));
-                }
-            }
-            return this;
-        }
-
-        Params withFields(String[] fields) {
-            if (CollectionUtils.isEmpty(fields) == false) {
-                return putParam("fields", String.join(",", fields));
-            }
-            return this;
-        }
-
         Params withPipeline(String pipeline) {
             return putParam("pipeline", pipeline);
         }
@@ -664,20 +381,6 @@ final class RequestConverters {
             return putParam("allow_partial_search_results", Boolean.toString(allowPartialSearchResults));
         }
 
-        Params withRealtime(boolean realtime) {
-            if (realtime == false) {
-                return putParam("realtime", Boolean.FALSE.toString());
-            }
-            return this;
-        }
-
-        Params withRefresh(boolean refresh) {
-            if (refresh) {
-                return withRefreshPolicy(RefreshPolicy.IMMEDIATE);
-            }
-            return this;
-        }
-
         Params withRefreshPolicy(RefreshPolicy refreshPolicy) {
             if (refreshPolicy != RefreshPolicy.NONE) {
                 return putParam("refresh", refreshPolicy.getValue());
@@ -685,46 +388,10 @@ final class RequestConverters {
             return this;
         }
 
-        Params withRequestsPerSecond(float requestsPerSecond) {
-            // the default in AbstractBulkByScrollRequest is Float.POSITIVE_INFINITY,
-            // but we don't want to add that to the URL parameters, instead we use -1
-            if (Float.isFinite(requestsPerSecond)) {
-                return putParam(RethrottleRequest.REQUEST_PER_SECOND_PARAMETER, Float.toString(requestsPerSecond));
-            } else {
-                return putParam(RethrottleRequest.REQUEST_PER_SECOND_PARAMETER, "-1");
-            }
-        }
-
-        Params withRetryOnConflict(int retryOnConflict) {
-            if (retryOnConflict > 0) {
-                return putParam("retry_on_conflict", String.valueOf(retryOnConflict));
-            }
-            return this;
-        }
-
         Params withRouting(String routing) {
             return putParam("routing", routing);
         }
 
-        Params withSlices(int slices) {
-            if (slices == 0) {
-                // translate to "auto" value in rest request so the receiving end doesn't throw error
-                return putParam("slices", AbstractBulkByScrollRequest.AUTO_SLICES_VALUE);
-            }
-            return putParam("slices", String.valueOf(slices));
-        }
-
-        Params withStoredFields(String[] storedFields) {
-            if (CollectionUtils.isEmpty(storedFields) == false) {
-                return putParam("stored_fields", String.join(",", storedFields));
-            }
-            return this;
-        }
-
-        Params withTerminateAfter(int terminateAfter) {
-            return putParam("terminate_after", String.valueOf(terminateAfter));
-        }
-
         Params withTimeout(TimeValue timeout) {
             return putParam("timeout", timeout);
         }
@@ -803,10 +470,6 @@ final class RequestConverters {
             putParam("ignore_unavailable", Boolean.toString(ignoreUnavailable));
             return this;
         }
-
-        Params withWaitForCompletion(Boolean waitForCompletion) {
-            return putParam("wait_for_completion", waitForCompletion.toString());
-        }
     }
 
     /**

+ 0 - 471
client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java

@@ -19,25 +19,11 @@ import org.elasticsearch.action.ActionRequest;
 import org.elasticsearch.action.ActionRequestValidationException;
 import org.elasticsearch.action.bulk.BulkRequest;
 import org.elasticsearch.action.bulk.BulkResponse;
-import org.elasticsearch.action.delete.DeleteRequest;
-import org.elasticsearch.action.delete.DeleteResponse;
-import org.elasticsearch.action.explain.ExplainRequest;
-import org.elasticsearch.action.explain.ExplainResponse;
-import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
-import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
-import org.elasticsearch.action.get.GetRequest;
-import org.elasticsearch.action.get.GetResponse;
-import org.elasticsearch.action.get.MultiGetRequest;
-import org.elasticsearch.action.get.MultiGetResponse;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.index.IndexResponse;
-import org.elasticsearch.action.search.MultiSearchRequest;
-import org.elasticsearch.action.search.MultiSearchResponse;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.search.SearchScrollRequest;
-import org.elasticsearch.action.update.UpdateRequest;
-import org.elasticsearch.action.update.UpdateResponse;
 import org.elasticsearch.aggregations.bucket.adjacency.AdjacencyMatrixAggregationBuilder;
 import org.elasticsearch.aggregations.bucket.adjacency.ParsedAdjacencyMatrix;
 import org.elasticsearch.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder;
@@ -49,21 +35,12 @@ import org.elasticsearch.client.analytics.ParsedStringStats;
 import org.elasticsearch.client.analytics.ParsedTopMetrics;
 import org.elasticsearch.client.analytics.StringStatsAggregationBuilder;
 import org.elasticsearch.client.analytics.TopMetricsAggregationBuilder;
-import org.elasticsearch.client.core.CountRequest;
-import org.elasticsearch.client.core.CountResponse;
-import org.elasticsearch.client.core.GetSourceRequest;
-import org.elasticsearch.client.core.GetSourceResponse;
-import org.elasticsearch.client.core.MainRequest;
 import org.elasticsearch.client.core.MainResponse;
-import org.elasticsearch.client.core.TermVectorsRequest;
-import org.elasticsearch.client.core.TermVectorsResponse;
 import org.elasticsearch.common.Strings;
 import org.elasticsearch.common.util.concurrent.FutureUtils;
 import org.elasticsearch.common.util.concurrent.ListenableFuture;
 import org.elasticsearch.core.CheckedConsumer;
 import org.elasticsearch.core.CheckedFunction;
-import org.elasticsearch.index.reindex.BulkByScrollResponse;
-import org.elasticsearch.index.reindex.ReindexRequest;
 import org.elasticsearch.plugins.spi.NamedXContentProvider;
 import org.elasticsearch.rest.RestResponse;
 import org.elasticsearch.rest.RestStatus;
@@ -196,7 +173,6 @@ import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static java.util.Collections.emptySet;
-import static java.util.Collections.singleton;
 import static java.util.stream.Collectors.toList;
 
 /**
@@ -358,187 +334,6 @@ public class RestHighLevelClient implements Closeable {
         );
     }
 
-    /**
-     * Executes a reindex request.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html">Reindex API on elastic.co</a>
-     * @param reindexRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final BulkByScrollResponse reindex(ReindexRequest reindexRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            reindexRequest,
-            RequestConverters::reindex,
-            options,
-            BulkByScrollResponse::fromXContent,
-            singleton(409)
-        );
-    }
-
-    /**
-     * Get the cluster info otherwise provided when sending an HTTP request to '/'
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final MainResponse info(RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            new MainRequest(),
-            (request) -> RequestConverters.info(),
-            options,
-            MainResponse::fromXContent,
-            emptySet()
-        );
-    }
-
-    /**
-     * Retrieves a document by id using the Get API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
-     * @param getRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final GetResponse get(GetRequest getRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(getRequest, RequestConverters::get, options, GetResponse::fromXContent, singleton(404));
-    }
-
-    /**
-     * Retrieves multiple documents by id using the Multi Get API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
-     * @param multiGetRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     * @deprecated use {@link #mget(MultiGetRequest, RequestOptions)} instead
-     */
-    @Deprecated
-    public final MultiGetResponse multiGet(MultiGetRequest multiGetRequest, RequestOptions options) throws IOException {
-        return mget(multiGetRequest, options);
-    }
-
-    /**
-     * Retrieves multiple documents by id using the Multi Get API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
-     * @param multiGetRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final MultiGetResponse mget(MultiGetRequest multiGetRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            multiGetRequest,
-            RequestConverters::multiGet,
-            options,
-            MultiGetResponse::fromXContent,
-            singleton(404)
-        );
-    }
-
-    /**
-     * Asynchronously retrieves multiple documents by id using the Multi Get API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
-     * @param multiGetRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @deprecated use {@link #mgetAsync(MultiGetRequest, RequestOptions, ActionListener)} instead
-     * @return cancellable that may be used to cancel the request
-     */
-    @Deprecated
-    public final Cancellable multiGetAsync(
-        MultiGetRequest multiGetRequest,
-        RequestOptions options,
-        ActionListener<MultiGetResponse> listener
-    ) {
-        return mgetAsync(multiGetRequest, options, listener);
-    }
-
-    /**
-     * Asynchronously retrieves multiple documents by id using the Multi Get API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html">Multi Get API on elastic.co</a>
-     * @param multiGetRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @return cancellable that may be used to cancel the request
-     */
-    public final Cancellable mgetAsync(MultiGetRequest multiGetRequest, RequestOptions options, ActionListener<MultiGetResponse> listener) {
-        return performRequestAsyncAndParseEntity(
-            multiGetRequest,
-            RequestConverters::multiGet,
-            options,
-            MultiGetResponse::fromXContent,
-            listener,
-            singleton(404)
-        );
-    }
-
-    /**
-     * Checks for the existence of a document. Returns true if it exists, false otherwise.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
-     * @param getRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return <code>true</code> if the document exists, <code>false</code> otherwise
-     */
-    public final boolean exists(GetRequest getRequest, RequestOptions options) throws IOException {
-        return performRequest(getRequest, RequestConverters::exists, options, RestHighLevelClient::convertExistsResponse, emptySet());
-    }
-
-    /**
-     * Checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#_source">Source exists API
-     * on elastic.co</a>
-     * @param getRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return <code>true</code> if the document and _source field exists, <code>false</code> otherwise
-     */
-    @Deprecated
-    public boolean existsSource(GetRequest getRequest, RequestOptions options) throws IOException {
-        GetSourceRequest getSourceRequest = GetSourceRequest.from(getRequest);
-        return performRequest(
-            getSourceRequest,
-            RequestConverters::sourceExists,
-            options,
-            RestHighLevelClient::convertExistsResponse,
-            emptySet()
-        );
-    }
-
-    /**
-     * Asynchronously checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#_source">Source exists API
-     * on elastic.co</a>
-     * @param getRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @return cancellable that may be used to cancel the request
-     */
-    @Deprecated
-    public final Cancellable existsSourceAsync(GetRequest getRequest, RequestOptions options, ActionListener<Boolean> listener) {
-        GetSourceRequest getSourceRequest = GetSourceRequest.from(getRequest);
-        return performRequestAsync(
-            getSourceRequest,
-            RequestConverters::sourceExists,
-            options,
-            RestHighLevelClient::convertExistsResponse,
-            listener,
-            emptySet()
-        );
-    }
-
-    /**
-     * Retrieves the source field only of a document using GetSource API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#_source">Get Source API
-     * on elastic.co</a>
-     * @param getSourceRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public GetSourceResponse getSource(GetSourceRequest getSourceRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            getSourceRequest,
-            RequestConverters::getSource,
-            options,
-            GetSourceResponse::fromXContent,
-            emptySet()
-        );
-    }
-
     /**
      * Index a document using the Index API.
      * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html">Index API on elastic.co</a>
@@ -550,45 +345,6 @@ public class RestHighLevelClient implements Closeable {
         return performRequestAndParseEntity(indexRequest, RequestConverters::index, options, IndexResponse::fromXContent, emptySet());
     }
 
-    /**
-     * Executes a count request using the Count API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html">Count API on elastic.co</a>
-     * @param countRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final CountResponse count(CountRequest countRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(countRequest, RequestConverters::count, options, CountResponse::fromXContent, emptySet());
-    }
-
-    /**
-     * Updates a document using the Update API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html">Update API on elastic.co</a>
-     * @param updateRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final UpdateResponse update(UpdateRequest updateRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(updateRequest, RequestConverters::update, options, UpdateResponse::fromXContent, emptySet());
-    }
-
-    /**
-     * Deletes a document by id using the Delete API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html">Delete API on elastic.co</a>
-     * @param deleteRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final DeleteResponse delete(DeleteRequest deleteRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            deleteRequest,
-            RequestConverters::delete,
-            options,
-            DeleteResponse::fromXContent,
-            singleton(404)
-        );
-    }
-
     /**
      * Executes a search request using the Search API.
      * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html">Search API on elastic.co</a>
@@ -625,96 +381,6 @@ public class RestHighLevelClient implements Closeable {
         );
     }
 
-    /**
-     * Executes a multi search using the msearch API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
-     * elastic.co</a>
-     * @param multiSearchRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     * @deprecated use {@link #msearch(MultiSearchRequest, RequestOptions)} instead
-     */
-    @Deprecated
-    public final MultiSearchResponse multiSearch(MultiSearchRequest multiSearchRequest, RequestOptions options) throws IOException {
-        return msearch(multiSearchRequest, options);
-    }
-
-    /**
-     * Executes a multi search using the msearch API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
-     * elastic.co</a>
-     * @param multiSearchRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final MultiSearchResponse msearch(MultiSearchRequest multiSearchRequest, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            multiSearchRequest,
-            RequestConverters::multiSearch,
-            options,
-            MultiSearchResponse::fromXContext,
-            emptySet()
-        );
-    }
-
-    /**
-     * Asynchronously executes a multi search using the msearch API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
-     * elastic.co</a>
-     * @param searchRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @deprecated use {@link #msearchAsync(MultiSearchRequest, RequestOptions, ActionListener)} instead
-     * @return cancellable that may be used to cancel the request
-     */
-    @Deprecated
-    public final Cancellable multiSearchAsync(
-        MultiSearchRequest searchRequest,
-        RequestOptions options,
-        ActionListener<MultiSearchResponse> listener
-    ) {
-        return msearchAsync(searchRequest, options, listener);
-    }
-
-    /**
-     * Asynchronously executes a multi search using the msearch API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html">Multi search API on
-     * elastic.co</a>
-     * @param searchRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @return cancellable that may be used to cancel the request
-     */
-    public final Cancellable msearchAsync(
-        MultiSearchRequest searchRequest,
-        RequestOptions options,
-        ActionListener<MultiSearchResponse> listener
-    ) {
-        return performRequestAsyncAndParseEntity(
-            searchRequest,
-            RequestConverters::multiSearch,
-            options,
-            MultiSearchResponse::fromXContext,
-            listener,
-            emptySet()
-        );
-    }
-
-    /**
-     * Executes a search using the Search Scroll API.
-     * See <a
-     * href="https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll">Search
-     * Scroll API on elastic.co</a>
-     * @param searchScrollRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     * @deprecated use {@link #scroll(SearchScrollRequest, RequestOptions)} instead
-     */
-    @Deprecated
-    public final SearchResponse searchScroll(SearchScrollRequest searchScrollRequest, RequestOptions options) throws IOException {
-        return scroll(searchScrollRequest, options);
-    }
-
     /**
      * Executes a search using the Search Scroll API.
      * See <a
@@ -734,106 +400,6 @@ public class RestHighLevelClient implements Closeable {
         );
     }
 
-    /**
-     * Asynchronously executes a search using the Search Scroll API.
-     * See <a
-     * href="https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll">Search
-     * Scroll API on elastic.co</a>
-     * @param searchScrollRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @deprecated use {@link #scrollAsync(SearchScrollRequest, RequestOptions, ActionListener)} instead
-     * @return cancellable that may be used to cancel the request
-     */
-    @Deprecated
-    public final Cancellable searchScrollAsync(
-        SearchScrollRequest searchScrollRequest,
-        RequestOptions options,
-        ActionListener<SearchResponse> listener
-    ) {
-        return scrollAsync(searchScrollRequest, options, listener);
-    }
-
-    /**
-     * Asynchronously executes a search using the Search Scroll API.
-     * See <a
-     * href="https://www.elastic.co/guide/en/elasticsearch/reference/master/search-request-body.html#request-body-search-scroll">Search
-     * Scroll API on elastic.co</a>
-     * @param searchScrollRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @param listener the listener to be notified upon request completion
-     * @return cancellable that may be used to cancel the request
-     */
-    public final Cancellable scrollAsync(
-        SearchScrollRequest searchScrollRequest,
-        RequestOptions options,
-        ActionListener<SearchResponse> listener
-    ) {
-        return performRequestAsyncAndParseEntity(
-            searchScrollRequest,
-            RequestConverters::searchScroll,
-            options,
-            SearchResponse::fromXContent,
-            listener,
-            emptySet()
-        );
-    }
-
-    /**
-     * Executes a request using the Explain API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html">Explain API on elastic.co</a>
-     * @param explainRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final ExplainResponse explain(ExplainRequest explainRequest, RequestOptions options) throws IOException {
-        return performRequest(explainRequest, RequestConverters::explain, options, response -> {
-            CheckedFunction<XContentParser, ExplainResponse, IOException> entityParser = parser -> ExplainResponse.fromXContent(
-                parser,
-                convertExistsResponse(response)
-            );
-            return parseEntity(response.getEntity(), entityParser);
-        }, singleton(404));
-    }
-
-    /**
-     * Calls the Term Vectors API
-     *
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html">Term Vectors API on
-     * elastic.co</a>
-     *
-     * @param request   the request
-     * @param options   the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     */
-    public final TermVectorsResponse termvectors(TermVectorsRequest request, RequestOptions options) throws IOException {
-        return performRequestAndParseEntity(
-            request,
-            RequestConverters::termVectors,
-            options,
-            TermVectorsResponse::fromXContent,
-            emptySet()
-        );
-    }
-
-    /**
-     * Executes a request using the Field Capabilities API.
-     * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html">Field Capabilities API
-     * on elastic.co</a>.
-     * @param fieldCapabilitiesRequest the request
-     * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
-     * @return the response
-     */
-    public final FieldCapabilitiesResponse fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest, RequestOptions options)
-        throws IOException {
-        return performRequestAndParseEntity(
-            fieldCapabilitiesRequest,
-            RequestConverters::fieldCaps,
-            options,
-            FieldCapabilitiesResponse::fromXContent,
-            emptySet()
-        );
-    }
-
     /**
      * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
      * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
@@ -849,19 +415,6 @@ public class RestHighLevelClient implements Closeable {
         return performRequest(request, requestConverter, options, response -> parseEntity(response.getEntity(), entityParser), ignores);
     }
 
-    /**
-     * Defines a helper method for performing a request and then parsing the returned entity using the provided entityParser.
-     */
-    protected final <Req extends Validatable, Resp> Resp performRequestAndParseEntity(
-        Req request,
-        CheckedFunction<Req, Request, IOException> requestConverter,
-        RequestOptions options,
-        CheckedFunction<XContentParser, Resp, IOException> entityParser,
-        Set<Integer> ignores
-    ) throws IOException {
-        return performRequest(request, requestConverter, options, response -> parseEntity(response.getEntity(), entityParser), ignores);
-    }
-
     /**
      * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
      * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
@@ -981,26 +534,6 @@ public class RestHighLevelClient implements Closeable {
         return internalPerformRequestAsync(request, requestConverter, options, responseConverter, listener, ignores);
     }
 
-    /**
-     * Defines a helper method for asynchronously performing a request.
-     * @return Cancellable instance that may be used to cancel the request
-     */
-    protected final <Req extends Validatable, Resp> Cancellable performRequestAsync(
-        Req request,
-        CheckedFunction<Req, Request, IOException> requestConverter,
-        RequestOptions options,
-        CheckedFunction<Response, Resp, IOException> responseConverter,
-        ActionListener<Resp> listener,
-        Set<Integer> ignores
-    ) {
-        Optional<ValidationException> validationException = request.validate();
-        if (validationException != null && validationException.isPresent()) {
-            listener.onFailure(validationException.get());
-            return Cancellable.NO_OP;
-        }
-        return internalPerformRequestAsync(request, requestConverter, options, responseConverter, listener, ignores);
-    }
-
     /**
      * Provides common functionality for asynchronously performing a request.
      * @return Cancellable instance that may be used to cancel the request
@@ -1110,10 +643,6 @@ public class RestHighLevelClient implements Closeable {
         }
     }
 
-    protected static boolean convertExistsResponse(Response response) {
-        return response.getStatusLine().getStatusCode() == 200;
-    }
-
     private enum EntityType {
         JSON() {
             @Override

+ 0 - 66
client/rest-high-level/src/main/java/org/elasticsearch/client/RethrottleRequest.java

@@ -1,66 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client;
-
-import org.elasticsearch.tasks.TaskId;
-
-import java.util.Objects;
-
-/**
- * A request changing throttling of a task.
- */
-public class RethrottleRequest implements Validatable {
-
-    static final String REQUEST_PER_SECOND_PARAMETER = "requests_per_second";
-
-    private final TaskId taskId;
-    private final float requestsPerSecond;
-
-    /**
-     * Create a new {@link RethrottleRequest} which disables any throttling for the given taskId.
-     * @param taskId the task for which throttling will be disabled
-     */
-    public RethrottleRequest(TaskId taskId) {
-        this.taskId = taskId;
-        this.requestsPerSecond = Float.POSITIVE_INFINITY;
-    }
-
-    /**
-     * Create a new {@link RethrottleRequest} which changes the throttling for the given taskId.
-     * @param taskId the task that throttling changes will be applied to
-     * @param requestsPerSecond the number of requests per second that the task should perform. This needs to be a positive value.
-     */
-    public RethrottleRequest(TaskId taskId, float requestsPerSecond) {
-        Objects.requireNonNull(taskId, "taskId cannot be null");
-        if (requestsPerSecond <= 0) {
-            throw new IllegalArgumentException("requestsPerSecond needs to be positive value but was [" + requestsPerSecond + "]");
-        }
-        this.taskId = taskId;
-        this.requestsPerSecond = requestsPerSecond;
-    }
-
-    /**
-     * @return the task Id
-     */
-    public TaskId getTaskId() {
-        return taskId;
-    }
-
-    /**
-     * @return the requests per seconds value
-     */
-    public float getRequestsPerSecond() {
-        return requestsPerSecond;
-    }
-
-    @Override
-    public String toString() {
-        return "RethrottleRequest: taskID = " + taskId + "; reqestsPerSecond = " + requestsPerSecond;
-    }
-}

+ 0 - 72
client/rest-high-level/src/main/java/org/elasticsearch/client/cluster/ProxyModeInfo.java

@@ -1,72 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.cluster;
-
-import java.util.Objects;
-
-public class ProxyModeInfo implements RemoteConnectionInfo.ModeInfo {
-    static final String NAME = "proxy";
-    static final String PROXY_ADDRESS = "proxy_address";
-    static final String SERVER_NAME = "server_name";
-    static final String NUM_PROXY_SOCKETS_CONNECTED = "num_proxy_sockets_connected";
-    static final String MAX_PROXY_SOCKET_CONNECTIONS = "max_proxy_socket_connections";
-    private final String address;
-    private final String serverName;
-    private final int maxSocketConnections;
-    private final int numSocketsConnected;
-
-    ProxyModeInfo(String address, String serverName, int maxSocketConnections, int numSocketsConnected) {
-        this.address = address;
-        this.serverName = serverName;
-        this.maxSocketConnections = maxSocketConnections;
-        this.numSocketsConnected = numSocketsConnected;
-    }
-
-    @Override
-    public boolean isConnected() {
-        return numSocketsConnected > 0;
-    }
-
-    @Override
-    public String modeName() {
-        return NAME;
-    }
-
-    public String getAddress() {
-        return address;
-    }
-
-    public String getServerName() {
-        return serverName;
-    }
-
-    public int getMaxSocketConnections() {
-        return maxSocketConnections;
-    }
-
-    public int getNumSocketsConnected() {
-        return numSocketsConnected;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        ProxyModeInfo otherProxy = (ProxyModeInfo) o;
-        return maxSocketConnections == otherProxy.maxSocketConnections
-            && numSocketsConnected == otherProxy.numSocketsConnected
-            && Objects.equals(address, otherProxy.address)
-            && Objects.equals(serverName, otherProxy.serverName);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(address, serverName, maxSocketConnections, numSocketsConnected);
-    }
-}

+ 0 - 127
client/rest-high-level/src/main/java/org/elasticsearch/client/cluster/RemoteConnectionInfo.java

@@ -1,127 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.cluster;
-
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Objects;
-
-import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg;
-import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-/**
- * This class encapsulates all remote cluster information to be rendered on
- * {@code _remote/info} requests.
- */
-public final class RemoteConnectionInfo {
-    private static final String CONNECTED = "connected";
-    private static final String MODE = "mode";
-    private static final String INITIAL_CONNECT_TIMEOUT = "initial_connect_timeout";
-    private static final String SKIP_UNAVAILABLE = "skip_unavailable";
-
-    @SuppressWarnings("unchecked")
-    private static final ConstructingObjectParser<RemoteConnectionInfo, String> PARSER = new ConstructingObjectParser<>(
-        "RemoteConnectionInfoObjectParser",
-        false,
-        (args, clusterAlias) -> {
-            String mode = (String) args[1];
-            ModeInfo modeInfo;
-            if (mode.equals(ProxyModeInfo.NAME)) {
-                modeInfo = new ProxyModeInfo((String) args[4], (String) args[5], (int) args[6], (int) args[7]);
-            } else if (mode.equals(SniffModeInfo.NAME)) {
-                modeInfo = new SniffModeInfo((List<String>) args[8], (int) args[9], (int) args[10]);
-            } else {
-                throw new IllegalArgumentException("mode cannot be " + mode);
-            }
-            return new RemoteConnectionInfo(clusterAlias, modeInfo, (String) args[2], (boolean) args[3]);
-        }
-    );
-
-    static {
-        PARSER.declareBoolean(constructorArg(), new ParseField(CONNECTED));
-        PARSER.declareString(constructorArg(), new ParseField(MODE));
-        PARSER.declareString(constructorArg(), new ParseField(INITIAL_CONNECT_TIMEOUT));
-        PARSER.declareBoolean(constructorArg(), new ParseField(SKIP_UNAVAILABLE));
-
-        PARSER.declareString(optionalConstructorArg(), new ParseField(ProxyModeInfo.PROXY_ADDRESS));
-        PARSER.declareString(optionalConstructorArg(), new ParseField(ProxyModeInfo.SERVER_NAME));
-        PARSER.declareInt(optionalConstructorArg(), new ParseField(ProxyModeInfo.MAX_PROXY_SOCKET_CONNECTIONS));
-        PARSER.declareInt(optionalConstructorArg(), new ParseField(ProxyModeInfo.NUM_PROXY_SOCKETS_CONNECTED));
-
-        PARSER.declareStringArray(optionalConstructorArg(), new ParseField(SniffModeInfo.SEEDS));
-        PARSER.declareInt(optionalConstructorArg(), new ParseField(SniffModeInfo.MAX_CONNECTIONS_PER_CLUSTER));
-        PARSER.declareInt(optionalConstructorArg(), new ParseField(SniffModeInfo.NUM_NODES_CONNECTED));
-    }
-
-    private final ModeInfo modeInfo;
-    // TODO: deprecate and remove this field in favor of initialConnectionTimeout field that is of type TimeValue.
-    // When rest api versioning exists then change org.elasticsearch.transport.RemoteConnectionInfo to properly serialize
-    // the initialConnectionTimeout field so that we can properly parse initialConnectionTimeout as TimeValue
-    private final String initialConnectionTimeoutString;
-    private final String clusterAlias;
-    private final boolean skipUnavailable;
-
-    RemoteConnectionInfo(String clusterAlias, ModeInfo modeInfo, String initialConnectionTimeoutString, boolean skipUnavailable) {
-        this.clusterAlias = clusterAlias;
-        this.modeInfo = modeInfo;
-        this.initialConnectionTimeoutString = initialConnectionTimeoutString;
-        this.skipUnavailable = skipUnavailable;
-    }
-
-    public boolean isConnected() {
-        return modeInfo.isConnected();
-    }
-
-    public String getClusterAlias() {
-        return clusterAlias;
-    }
-
-    public ModeInfo getModeInfo() {
-        return modeInfo;
-    }
-
-    public String getInitialConnectionTimeoutString() {
-        return initialConnectionTimeoutString;
-    }
-
-    public boolean isSkipUnavailable() {
-        return skipUnavailable;
-    }
-
-    public static RemoteConnectionInfo fromXContent(XContentParser parser, String clusterAlias) throws IOException {
-        return PARSER.parse(parser, clusterAlias);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        RemoteConnectionInfo that = (RemoteConnectionInfo) o;
-        return skipUnavailable == that.skipUnavailable
-            && Objects.equals(modeInfo, that.modeInfo)
-            && Objects.equals(initialConnectionTimeoutString, that.initialConnectionTimeoutString)
-            && Objects.equals(clusterAlias, that.clusterAlias);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(modeInfo, initialConnectionTimeoutString, clusterAlias, skipUnavailable);
-    }
-
-    public interface ModeInfo {
-
-        boolean isConnected();
-
-        String modeName();
-    }
-}

+ 0 - 65
client/rest-high-level/src/main/java/org/elasticsearch/client/cluster/SniffModeInfo.java

@@ -1,65 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.cluster;
-
-import java.util.List;
-import java.util.Objects;
-
-public class SniffModeInfo implements RemoteConnectionInfo.ModeInfo {
-    public static final String NAME = "sniff";
-    static final String SEEDS = "seeds";
-    static final String NUM_NODES_CONNECTED = "num_nodes_connected";
-    static final String MAX_CONNECTIONS_PER_CLUSTER = "max_connections_per_cluster";
-    final List<String> seedNodes;
-    final int maxConnectionsPerCluster;
-    final int numNodesConnected;
-
-    SniffModeInfo(List<String> seedNodes, int maxConnectionsPerCluster, int numNodesConnected) {
-        this.seedNodes = seedNodes;
-        this.maxConnectionsPerCluster = maxConnectionsPerCluster;
-        this.numNodesConnected = numNodesConnected;
-    }
-
-    @Override
-    public boolean isConnected() {
-        return numNodesConnected > 0;
-    }
-
-    @Override
-    public String modeName() {
-        return NAME;
-    }
-
-    public List<String> getSeedNodes() {
-        return seedNodes;
-    }
-
-    public int getMaxConnectionsPerCluster() {
-        return maxConnectionsPerCluster;
-    }
-
-    public int getNumNodesConnected() {
-        return numNodesConnected;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-        SniffModeInfo sniff = (SniffModeInfo) o;
-        return maxConnectionsPerCluster == sniff.maxConnectionsPerCluster
-            && numNodesConnected == sniff.numNodesConnected
-            && Objects.equals(seedNodes, sniff.seedNodes);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(seedNodes, maxConnectionsPerCluster, numNodesConnected);
-    }
-}

+ 0 - 174
client/rest-high-level/src/main/java/org/elasticsearch/client/core/BroadcastResponse.java

@@ -1,174 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.action.support.DefaultShardOperationFailedException;
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Objects;
-
-/**
- * Represents a response to a request that is broadcast to a collection of shards.
- */
-public class BroadcastResponse {
-
-    private final Shards shards;
-
-    /**
-     * Represents the shard-level summary of the response execution.
-     *
-     * @return the shard-level response summary
-     */
-    public Shards shards() {
-        return shards;
-    }
-
-    protected BroadcastResponse(final Shards shards) {
-        this.shards = Objects.requireNonNull(shards);
-    }
-
-    private static final ParseField SHARDS_FIELD = new ParseField("_shards");
-
-    static final ConstructingObjectParser<BroadcastResponse, Void> PARSER = new ConstructingObjectParser<>(
-        "broadcast_response",
-        a -> new BroadcastResponse((Shards) a[0])
-    );
-
-    static {
-        declareShardsField(PARSER);
-    }
-
-    /**
-     * Parses a broadcast response.
-     *
-     * @param parser the parser
-     * @return a broadcast response parsed from the specified parser
-     * @throws IOException if an I/O exception occurs parsing the response
-     */
-    public static BroadcastResponse fromXContent(final XContentParser parser) throws IOException {
-        return PARSER.parse(parser, null);
-    }
-
-    protected static <T extends BroadcastResponse> void declareShardsField(ConstructingObjectParser<T, Void> parser) {
-        parser.declareObject(ConstructingObjectParser.constructorArg(), Shards.SHARDS_PARSER, SHARDS_FIELD);
-    }
-
-    /**
-     * Represents the results of a collection of shards on which a request was executed against.
-     */
-    public static class Shards {
-
-        private final int total;
-
-        /**
-         * The total number of shards on which a request was executed against.
-         *
-         * @return the total number of shards
-         */
-        public int total() {
-            return total;
-        }
-
-        private final int successful;
-
-        /**
-         * The number of successful shards on which a request was executed against.
-         *
-         * @return the number of successful shards
-         */
-        public int successful() {
-            return successful;
-        }
-
-        private final int skipped;
-
-        /**
-         * The number of shards skipped by the request.
-         *
-         * @return the number of skipped shards
-         */
-        public int skipped() {
-            return skipped;
-        }
-
-        private final int failed;
-
-        /**
-         * The number of shards on which a request failed to be executed against.
-         *
-         * @return the number of failed shards
-         */
-        public int failed() {
-            return failed;
-        }
-
-        private final Collection<DefaultShardOperationFailedException> failures;
-
-        /**
-         * The failures corresponding to the shards on which a request failed to be executed against. Note that the number of failures might
-         * not match {@link #failed()} as some responses group together shard failures.
-         *
-         * @return the failures
-         */
-        public Collection<DefaultShardOperationFailedException> failures() {
-            return failures;
-        }
-
-        Shards(
-            final int total,
-            final int successful,
-            final int skipped,
-            final int failed,
-            final Collection<DefaultShardOperationFailedException> failures
-        ) {
-            this.total = total;
-            this.successful = successful;
-            this.skipped = skipped;
-            this.failed = failed;
-            this.failures = Collections.unmodifiableCollection(Objects.requireNonNull(failures));
-        }
-
-        private static final ParseField TOTAL_FIELD = new ParseField("total");
-        private static final ParseField SUCCESSFUL_FIELD = new ParseField("successful");
-        private static final ParseField SKIPPED_FIELD = new ParseField("skipped");
-        private static final ParseField FAILED_FIELD = new ParseField("failed");
-        private static final ParseField FAILURES_FIELD = new ParseField("failures");
-
-        @SuppressWarnings("unchecked")
-        static final ConstructingObjectParser<Shards, Void> SHARDS_PARSER = new ConstructingObjectParser<>(
-            "shards",
-            a -> new Shards(
-                (int) a[0], // total
-                (int) a[1], // successful
-                a[2] == null ? 0 : (int) a[2], // skipped
-                (int) a[3], // failed
-                a[4] == null ? Collections.emptyList() : (Collection<DefaultShardOperationFailedException>) a[4]
-            )
-        ); // failures
-
-        static {
-            SHARDS_PARSER.declareInt(ConstructingObjectParser.constructorArg(), TOTAL_FIELD);
-            SHARDS_PARSER.declareInt(ConstructingObjectParser.constructorArg(), SUCCESSFUL_FIELD);
-            SHARDS_PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), SKIPPED_FIELD);
-            SHARDS_PARSER.declareInt(ConstructingObjectParser.constructorArg(), FAILED_FIELD);
-            SHARDS_PARSER.declareObjectArray(
-                ConstructingObjectParser.optionalConstructorArg(),
-                DefaultShardOperationFailedException.PARSER,
-                FAILURES_FIELD
-            );
-        }
-
-    }
-
-}

+ 0 - 249
client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountRequest.java

@@ -1,249 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.action.support.IndicesOptions;
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.common.Strings;
-import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.search.builder.SearchSourceBuilder;
-import org.elasticsearch.search.internal.SearchContext;
-import org.elasticsearch.xcontent.ToXContentObject;
-import org.elasticsearch.xcontent.XContentBuilder;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Objects;
-
-/**
- * Encapsulates a request to _count API against one, several or all indices.
- */
-public final class CountRequest implements Validatable, ToXContentObject {
-
-    private String[] indices = Strings.EMPTY_ARRAY;
-    private String[] types = Strings.EMPTY_ARRAY;
-    private String routing;
-    private String preference;
-    private QueryBuilder query;
-    private IndicesOptions indicesOptions;
-    private int terminateAfter = SearchContext.DEFAULT_TERMINATE_AFTER;
-    private Float minScore;
-
-    public CountRequest() {}
-
-    /**
-     * Constructs a new count request against the indices. No indices provided here means that count will execute on all indices.
-     */
-    public CountRequest(String... indices) {
-        indices(indices);
-    }
-
-    /**
-     * Constructs a new search request against the provided indices with the given search source.
-     *
-     * @deprecated The count api only supports a query. Use {@link #CountRequest(String[], QueryBuilder)} instead.
-     */
-    @Deprecated
-    public CountRequest(String[] indices, SearchSourceBuilder searchSourceBuilder) {
-        indices(indices);
-        this.query = Objects.requireNonNull(searchSourceBuilder, "source must not be null").query();
-    }
-
-    /**
-     * Constructs a new search request against the provided indices with the given query.
-     */
-    public CountRequest(String[] indices, QueryBuilder query) {
-        indices(indices);
-        this.query = Objects.requireNonNull(query, "query must not be null");
-        ;
-    }
-
-    /**
-     * Sets the indices the count will be executed on.
-     */
-    public CountRequest indices(String... indices) {
-        Objects.requireNonNull(indices, "indices must not be null");
-        for (String index : indices) {
-            Objects.requireNonNull(index, "index must not be null");
-        }
-        this.indices = indices;
-        return this;
-    }
-
-    /**
-     * The source of the count request.
-     *
-     * @deprecated The count api only supports a query. Use {@link #query(QueryBuilder)} instead.
-     */
-    @Deprecated
-    public CountRequest source(SearchSourceBuilder searchSourceBuilder) {
-        this.query = Objects.requireNonNull(searchSourceBuilder, "source must not be null").query();
-        return this;
-    }
-
-    /**
-     * Sets the query to execute for this count request.
-     */
-    public CountRequest query(QueryBuilder query) {
-        this.query = Objects.requireNonNull(query, "query must not be null");
-        return this;
-    }
-
-    /**
-     * The document types to execute the count against. Defaults to be executed against all types.
-     *
-     * @deprecated Types are in the process of being removed. Instead of using a type, prefer to
-     * filter on a field on the document.
-     */
-    @Deprecated
-    public CountRequest types(String... types) {
-        Objects.requireNonNull(types, "types must not be null");
-        for (String type : types) {
-            Objects.requireNonNull(type, "type must not be null");
-        }
-        this.types = types;
-        return this;
-    }
-
-    /**
-     * The routing values to control the shards that the search will be executed on.
-     */
-    public CountRequest routing(String routing) {
-        this.routing = routing;
-        return this;
-    }
-
-    /**
-     * A comma separated list of routing values to control the shards the count will be executed on.
-     */
-    public CountRequest routing(String... routings) {
-        this.routing = Strings.arrayToCommaDelimitedString(routings);
-        return this;
-    }
-
-    /**
-     * Returns the indices options used to resolve indices. They tell for instance whether a single index is accepted, whether an empty
-     * array will be converted to _all, and how wildcards will be expanded if needed.
-     *
-     * @see org.elasticsearch.action.support.IndicesOptions
-     */
-    public CountRequest indicesOptions(IndicesOptions indicesOptions) {
-        this.indicesOptions = Objects.requireNonNull(indicesOptions, "indicesOptions must not be null");
-        return this;
-    }
-
-    /**
-     * Sets the preference to execute the count. Defaults to randomize across shards. Can be set to {@code _local} to prefer local shards
-     * or a custom value, which guarantees that the same order will be used across different requests.
-     */
-    public CountRequest preference(String preference) {
-        this.preference = preference;
-        return this;
-    }
-
-    public IndicesOptions indicesOptions() {
-        return this.indicesOptions;
-    }
-
-    public String routing() {
-        return this.routing;
-    }
-
-    public String preference() {
-        return this.preference;
-    }
-
-    public String[] indices() {
-        return Arrays.copyOf(this.indices, this.indices.length);
-    }
-
-    public Float minScore() {
-        return minScore;
-    }
-
-    public CountRequest minScore(Float minScore) {
-        this.minScore = minScore;
-        return this;
-    }
-
-    public int terminateAfter() {
-        return this.terminateAfter;
-    }
-
-    public CountRequest terminateAfter(int terminateAfter) {
-        if (terminateAfter < 0) {
-            throw new IllegalArgumentException("terminateAfter must be > 0");
-        }
-        this.terminateAfter = terminateAfter;
-        return this;
-    }
-
-    /**
-     * @deprecated Types are in the process of being removed. Instead of using a type, prefer to
-     * filter on a field on the document.
-     */
-    @Deprecated
-    public String[] types() {
-        return Arrays.copyOf(this.types, this.types.length);
-    }
-
-    /**
-     * @return the source builder
-     * @deprecated The count api only supports a query. Use {@link #query()} instead.
-     */
-    @Deprecated
-    public SearchSourceBuilder source() {
-        return new SearchSourceBuilder().query(query);
-    }
-
-    /**
-     * @return The provided query to execute with the count request or
-     * <code>null</code> if no query was provided.
-     */
-    public QueryBuilder query() {
-        return query;
-    }
-
-    @Override
-    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
-        builder.startObject();
-        if (query != null) {
-            builder.field("query", query);
-        }
-        builder.endObject();
-        return builder;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        CountRequest that = (CountRequest) o;
-        return Objects.equals(indicesOptions, that.indicesOptions)
-            && Arrays.equals(indices, that.indices)
-            && Arrays.equals(types, that.types)
-            && Objects.equals(routing, that.routing)
-            && Objects.equals(preference, that.preference)
-            && Objects.equals(terminateAfter, that.terminateAfter)
-            && Objects.equals(minScore, that.minScore)
-            && Objects.equals(query, that.query);
-    }
-
-    @Override
-    public int hashCode() {
-        int result = Objects.hash(indicesOptions, routing, preference, terminateAfter, minScore, query);
-        result = 31 * result + Arrays.hashCode(indices);
-        result = 31 * result + Arrays.hashCode(types);
-        return result;
-    }
-}

+ 0 - 230
client/rest-high-level/src/main/java/org/elasticsearch/client/core/CountResponse.java

@@ -1,230 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.action.search.ShardSearchFailure;
-import org.elasticsearch.rest.RestStatus;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken;
-
-/**
- * A response to _count API request.
- */
-public final class CountResponse {
-
-    static final ParseField COUNT = new ParseField("count");
-    static final ParseField TERMINATED_EARLY = new ParseField("terminated_early");
-    static final ParseField SHARDS = new ParseField("_shards");
-
-    private final long count;
-    private final Boolean terminatedEarly;
-    private final ShardStats shardStats;
-
-    public CountResponse(long count, Boolean terminatedEarly, ShardStats shardStats) {
-        this.count = count;
-        this.terminatedEarly = terminatedEarly;
-        this.shardStats = shardStats;
-    }
-
-    public ShardStats getShardStats() {
-        return shardStats;
-    }
-
-    /**
-     * Number of documents matching request.
-     */
-    public long getCount() {
-        return count;
-    }
-
-    /**
-     * The total number of shards the search was executed on.
-     */
-    public int getTotalShards() {
-        return shardStats.totalShards;
-    }
-
-    /**
-     * The successful number of shards the search was executed on.
-     */
-    public int getSuccessfulShards() {
-        return shardStats.successfulShards;
-    }
-
-    /**
-     * The number of shards skipped due to pre-filtering
-     */
-    public int getSkippedShards() {
-        return shardStats.skippedShards;
-    }
-
-    /**
-     * The failed number of shards the search was executed on.
-     */
-    public int getFailedShards() {
-        return shardStats.shardFailures.length;
-    }
-
-    /**
-     * The failures that occurred during the search.
-     */
-    public ShardSearchFailure[] getShardFailures() {
-        return shardStats.shardFailures;
-    }
-
-    public RestStatus status() {
-        return RestStatus.status(shardStats.successfulShards, shardStats.totalShards, shardStats.shardFailures);
-    }
-
-    public static CountResponse fromXContent(XContentParser parser) throws IOException {
-        ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser);
-        parser.nextToken();
-        ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.currentToken(), parser);
-        String currentName = parser.currentName();
-        Boolean terminatedEarly = null;
-        long count = 0;
-        ShardStats shardStats = new ShardStats(-1, -1, 0, ShardSearchFailure.EMPTY_ARRAY);
-
-        for (XContentParser.Token token = parser.nextToken(); token != XContentParser.Token.END_OBJECT; token = parser.nextToken()) {
-            if (token == XContentParser.Token.FIELD_NAME) {
-                currentName = parser.currentName();
-            } else if (token.isValue()) {
-                if (COUNT.match(currentName, parser.getDeprecationHandler())) {
-                    count = parser.longValue();
-                } else if (TERMINATED_EARLY.match(currentName, parser.getDeprecationHandler())) {
-                    terminatedEarly = parser.booleanValue();
-                } else {
-                    parser.skipChildren();
-                }
-            } else if (token == XContentParser.Token.START_OBJECT) {
-                if (SHARDS.match(currentName, parser.getDeprecationHandler())) {
-                    shardStats = ShardStats.fromXContent(parser);
-                } else {
-                    parser.skipChildren();
-                }
-            }
-        }
-        return new CountResponse(count, terminatedEarly, shardStats);
-    }
-
-    @Override
-    public String toString() {
-        String s = "{"
-            + "count="
-            + count
-            + (isTerminatedEarly() != null ? ", terminatedEarly=" + terminatedEarly : "")
-            + ", "
-            + shardStats
-            + '}';
-        return s;
-    }
-
-    public Boolean isTerminatedEarly() {
-        return terminatedEarly;
-    }
-
-    /**
-     * Encapsulates _shards section of count api response.
-     */
-    public static final class ShardStats {
-
-        static final ParseField FAILED = new ParseField("failed");
-        static final ParseField SKIPPED = new ParseField("skipped");
-        static final ParseField TOTAL = new ParseField("total");
-        static final ParseField SUCCESSFUL = new ParseField("successful");
-        static final ParseField FAILURES = new ParseField("failures");
-
-        private final int successfulShards;
-        private final int totalShards;
-        private final int skippedShards;
-        private final ShardSearchFailure[] shardFailures;
-
-        public ShardStats(int successfulShards, int totalShards, int skippedShards, ShardSearchFailure[] shardFailures) {
-            this.successfulShards = successfulShards;
-            this.totalShards = totalShards;
-            this.skippedShards = skippedShards;
-            this.shardFailures = Arrays.copyOf(shardFailures, shardFailures.length);
-        }
-
-        public int getSuccessfulShards() {
-            return successfulShards;
-        }
-
-        public int getTotalShards() {
-            return totalShards;
-        }
-
-        public int getSkippedShards() {
-            return skippedShards;
-        }
-
-        public ShardSearchFailure[] getShardFailures() {
-            return Arrays.copyOf(shardFailures, shardFailures.length, ShardSearchFailure[].class);
-        }
-
-        static ShardStats fromXContent(XContentParser parser) throws IOException {
-            int successfulShards = -1;
-            int totalShards = -1;
-            int skippedShards = 0; // BWC @see org.elasticsearch.action.search.SearchResponse
-            List<ShardSearchFailure> failures = new ArrayList<>();
-            XContentParser.Token token;
-            String currentName = parser.currentName();
-            while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
-                if (token == XContentParser.Token.FIELD_NAME) {
-                    currentName = parser.currentName();
-                } else if (token.isValue()) {
-                    if (FAILED.match(currentName, parser.getDeprecationHandler())) {
-                        parser.intValue();
-                    } else if (SKIPPED.match(currentName, parser.getDeprecationHandler())) {
-                        skippedShards = parser.intValue();
-                    } else if (TOTAL.match(currentName, parser.getDeprecationHandler())) {
-                        totalShards = parser.intValue();
-                    } else if (SUCCESSFUL.match(currentName, parser.getDeprecationHandler())) {
-                        successfulShards = parser.intValue();
-                    } else {
-                        parser.skipChildren();
-                    }
-                } else if (token == XContentParser.Token.START_ARRAY) {
-                    if (FAILURES.match(currentName, parser.getDeprecationHandler())) {
-                        while ((parser.nextToken()) != XContentParser.Token.END_ARRAY) {
-                            failures.add(ShardSearchFailure.fromXContent(parser));
-                        }
-                    } else {
-                        parser.skipChildren();
-                    }
-                } else {
-                    parser.skipChildren();
-                }
-            }
-            return new ShardStats(successfulShards, totalShards, skippedShards, failures.toArray(new ShardSearchFailure[failures.size()]));
-        }
-
-        @Override
-        public String toString() {
-            return "_shards : {"
-                + "total="
-                + totalShards
-                + ", successful="
-                + successfulShards
-                + ", skipped="
-                + skippedShards
-                + ", failed="
-                + (shardFailures != null && shardFailures.length > 0 ? shardFailures.length : 0)
-                + (shardFailures != null && shardFailures.length > 0 ? ", failures: " + Arrays.asList(shardFailures) : "")
-                + '}';
-        }
-    }
-}

+ 0 - 115
client/rest-high-level/src/main/java/org/elasticsearch/client/core/GetSourceRequest.java

@@ -1,115 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.action.get.GetRequest;
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
-
-public final class GetSourceRequest implements Validatable {
-    private String routing;
-    private String preference;
-
-    private boolean refresh = false;
-    private boolean realtime = true;
-
-    private FetchSourceContext fetchSourceContext;
-
-    private final String index;
-    private final String id;
-
-    public GetSourceRequest(String index, String id) {
-        this.index = index;
-        this.id = id;
-    }
-
-    public static GetSourceRequest from(GetRequest getRequest) {
-        return new GetSourceRequest(getRequest.index(), getRequest.id()).routing(getRequest.routing())
-            .preference(getRequest.preference())
-            .refresh(getRequest.refresh())
-            .realtime(getRequest.realtime())
-            .fetchSourceContext(getRequest.fetchSourceContext());
-    }
-
-    /**
-     * Controls the shard routing of the request. Using this value to hash the shard
-     * and not the id.
-     */
-    public GetSourceRequest routing(String routing) {
-        if (routing != null && routing.length() == 0) {
-            this.routing = null;
-        } else {
-            this.routing = routing;
-        }
-        return this;
-    }
-
-    /**
-     * Sets the preference to execute the search. Defaults to randomize across shards. Can be set to
-     * {@code _local} to prefer local shards or a custom value, which guarantees that the same order
-     * will be used across different requests.
-     */
-    public GetSourceRequest preference(String preference) {
-        this.preference = preference;
-        return this;
-    }
-
-    /**
-     * Should a refresh be executed before this get operation causing the operation to
-     * return the latest value. Note, heavy get should not set this to {@code true}. Defaults
-     * to {@code false}.
-     */
-    public GetSourceRequest refresh(boolean refresh) {
-        this.refresh = refresh;
-        return this;
-    }
-
-    public GetSourceRequest realtime(boolean realtime) {
-        this.realtime = realtime;
-        return this;
-    }
-
-    /**
-     * Allows setting the {@link FetchSourceContext} for this request, controlling if and how _source should be returned.
-     * Note, the {@code fetchSource} field of the context must be set to {@code true}.
-     */
-
-    public GetSourceRequest fetchSourceContext(FetchSourceContext context) {
-        this.fetchSourceContext = context;
-        return this;
-    }
-
-    public String index() {
-        return index;
-    }
-
-    public String id() {
-        return id;
-    }
-
-    public String routing() {
-        return routing;
-    }
-
-    public String preference() {
-        return preference;
-    }
-
-    public boolean refresh() {
-        return refresh;
-    }
-
-    public boolean realtime() {
-        return realtime;
-    }
-
-    public FetchSourceContext fetchSourceContext() {
-        return fetchSourceContext;
-    }
-}

+ 0 - 36
client/rest-high-level/src/main/java/org/elasticsearch/client/core/GetSourceResponse.java

@@ -1,36 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.io.IOException;
-import java.util.Map;
-
-public final class GetSourceResponse {
-
-    private final Map<String, Object> source;
-
-    public GetSourceResponse(Map<String, Object> source) {
-        this.source = source;
-    }
-
-    public static GetSourceResponse fromXContent(XContentParser parser) throws IOException {
-        return new GetSourceResponse(parser.map());
-    }
-
-    public Map<String, Object> getSource() {
-        return this.source;
-    }
-
-    @Override
-    public String toString() {
-        return source.toString();
-    }
-}

+ 0 - 13
client/rest-high-level/src/main/java/org/elasticsearch/client/core/MainRequest.java

@@ -1,13 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.client.Validatable;
-
-public class MainRequest implements Validatable {}

+ 0 - 66
client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsRequest.java

@@ -1,66 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.xcontent.ToXContentObject;
-import org.elasticsearch.xcontent.XContentBuilder;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.elasticsearch.client.core.TermVectorsRequest.createFromTemplate;
-
-public class MultiTermVectorsRequest implements ToXContentObject, Validatable {
-
-    private List<TermVectorsRequest> requests = new ArrayList<>();
-
-    /**
-     * Constructs an empty MultiTermVectorsRequest
-     * After that use {@code add} method to add individual {@code TermVectorsRequest} to it.
-     */
-    public MultiTermVectorsRequest() {}
-
-    /**
-     * Constructs a MultiTermVectorsRequest from the given document ids
-     * and a template {@code TermVectorsRequest}.
-     * Used when individual requests share the same index, type and other settings.
-     * @param ids - ids of documents for which term vectors are requested
-     * @param template - a template {@code TermVectorsRequest} that allows to set all
-     * settings only once for all requests.
-     */
-    public MultiTermVectorsRequest(String[] ids, TermVectorsRequest template) {
-        for (String id : ids) {
-            TermVectorsRequest request = createFromTemplate(template, id);
-            requests.add(request);
-        }
-    }
-
-    /**
-     * Adds another {@code TermVectorsRequest} to this {@code MultiTermVectorsRequest}
-     * @param request - {@code TermVectorsRequest} to add
-     */
-    public void add(TermVectorsRequest request) {
-        requests.add(request);
-    }
-
-    @Override
-    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
-        builder.startObject();
-        builder.startArray("docs");
-        for (TermVectorsRequest request : requests) {
-            request.toXContent(builder, params);
-        }
-        builder.endArray();
-        builder.endObject();
-        return builder;
-    }
-
-}

+ 0 - 66
client/rest-high-level/src/main/java/org/elasticsearch/client/core/MultiTermVectorsResponse.java

@@ -1,66 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.util.List;
-import java.util.Objects;
-
-import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg;
-
-public class MultiTermVectorsResponse {
-    private final List<TermVectorsResponse> responses;
-
-    public MultiTermVectorsResponse(List<TermVectorsResponse> responses) {
-        this.responses = responses;
-    }
-
-    private static final ConstructingObjectParser<MultiTermVectorsResponse, Void> PARSER = new ConstructingObjectParser<>(
-        "multi_term_vectors",
-        true,
-        args -> {
-            // as the response comes from server, we are sure that args[0] will be a list of TermVectorsResponse
-            @SuppressWarnings("unchecked")
-            List<TermVectorsResponse> termVectorsResponsesList = (List<TermVectorsResponse>) args[0];
-            return new MultiTermVectorsResponse(termVectorsResponsesList);
-        }
-    );
-
-    static {
-        PARSER.declareObjectArray(constructorArg(), (p, c) -> TermVectorsResponse.fromXContent(p), new ParseField("docs"));
-    }
-
-    public static MultiTermVectorsResponse fromXContent(XContentParser parser) {
-        return PARSER.apply(parser, null);
-    }
-
-    /**
-     * Returns the list of {@code TermVectorsResponse} for this {@code MultiTermVectorsResponse}
-     */
-    public List<TermVectorsResponse> getTermVectorsResponses() {
-        return responses;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if ((obj instanceof MultiTermVectorsResponse) == false) return false;
-        MultiTermVectorsResponse other = (MultiTermVectorsResponse) obj;
-        return Objects.equals(responses, other.responses);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(responses);
-    }
-
-}

+ 0 - 89
client/rest-high-level/src/main/java/org/elasticsearch/client/core/PageParams.java

@@ -1,89 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.ToXContentObject;
-import org.elasticsearch.xcontent.XContentBuilder;
-
-import java.io.IOException;
-import java.util.Objects;
-
-/**
- * Paging parameters for GET requests
- */
-public class PageParams implements ToXContentObject {
-
-    public static final ParseField PAGE = new ParseField("page");
-    public static final ParseField FROM = new ParseField("from");
-    public static final ParseField SIZE = new ParseField("size");
-
-    public static final ConstructingObjectParser<PageParams, Void> PARSER = new ConstructingObjectParser<>(
-        PAGE.getPreferredName(),
-        a -> new PageParams((Integer) a[0], (Integer) a[1])
-    );
-
-    static {
-        PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), FROM);
-        PARSER.declareInt(ConstructingObjectParser.optionalConstructorArg(), SIZE);
-    }
-
-    private final Integer from;
-    private final Integer size;
-
-    /**
-     * Constructs paging parameters
-     * @param from skips the specified number of items. When {@code null} the default value will be used.
-     * @param size specifies the maximum number of items to obtain. When {@code null} the default value will be used.
-     */
-    public PageParams(@Nullable Integer from, @Nullable Integer size) {
-        this.from = from;
-        this.size = size;
-    }
-
-    public Integer getFrom() {
-        return from;
-    }
-
-    public Integer getSize() {
-        return size;
-    }
-
-    @Override
-    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
-        builder.startObject();
-        if (from != null) {
-            builder.field(FROM.getPreferredName(), from);
-        }
-        if (size != null) {
-            builder.field(SIZE.getPreferredName(), size);
-        }
-        builder.endObject();
-        return builder;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(from, size);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        PageParams other = (PageParams) obj;
-        return Objects.equals(from, other.from) && Objects.equals(size, other.size);
-    }
-
-}

+ 0 - 284
client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsRequest.java

@@ -1,284 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.client.Validatable;
-import org.elasticsearch.common.bytes.BytesReference;
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.xcontent.ToXContentObject;
-import org.elasticsearch.xcontent.XContentBuilder;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
-public class TermVectorsRequest implements ToXContentObject, Validatable {
-
-    private final String index;
-    @Nullable
-    private final String type;
-    private String id = null;
-    private XContentBuilder docBuilder = null;
-
-    private String routing = null;
-    private String preference = null;
-    private boolean realtime = true;
-    private String[] fields = null;
-    private boolean requestPositions = true;
-    private boolean requestPayloads = true;
-    private boolean requestOffsets = true;
-    private boolean requestFieldStatistics = true;
-    private boolean requestTermStatistics = false;
-    private Map<String, String> perFieldAnalyzer = null;
-    private Map<String, Integer> filterSettings = null;
-
-    /**
-     * Constructs TermVectorRequest for the given document
-     *
-     * @param index - index of the document
-     * @param docId - id of the document
-     */
-    public TermVectorsRequest(String index, String docId) {
-        this.index = index;
-        this.type = null;
-        this.id = docId;
-    }
-
-    /**
-     * Constructs TermVectorRequest for the given document
-     *
-     * @param index - index of the document
-     * @param type - type of the document
-     * @param docId - id of the document
-     *
-     * @deprecated Types are in the process of being removed, use
-     * {@link #TermVectorsRequest(String, String)} instead.
-     */
-    @Deprecated
-    public TermVectorsRequest(String index, String type, String docId) {
-        this.index = index;
-        this.type = type;
-        this.id = docId;
-    }
-
-    /**
-     * Constructs TermVectorRequest for an artificial document
-     *
-     * @param index - index of the document
-     * @param docBuilder - an artificial document
-     */
-    public TermVectorsRequest(String index, XContentBuilder docBuilder) {
-        this.index = index;
-        this.type = null;
-        this.docBuilder = docBuilder;
-    }
-
-    /**
-     * Constructs TermVectorRequest for an artificial document
-     * @param index - index of the document
-     * @param type - type of the document
-     * @param docBuilder - an artificial document
-     *
-     * @deprecated Types are in the process of being removed, use
-     * {@link TermVectorsRequest(String, XContentBuilder)} instead.
-     */
-    @Deprecated
-    public TermVectorsRequest(String index, String type, XContentBuilder docBuilder) {
-        this.index = index;
-        this.type = type;
-        this.docBuilder = docBuilder;
-    }
-
-    /**
-     * Constructs a new TermVectorRequest from a template
-     * using the provided document id
-     * @param template - a term vector request served as a template
-     * @param id - id of the requested document
-     */
-    static TermVectorsRequest createFromTemplate(TermVectorsRequest template, String id) {
-        TermVectorsRequest request = new TermVectorsRequest(template.getIndex(), template.getType(), id);
-        request.realtime = template.getRealtime();
-        request.requestPositions = template.requestPositions;
-        request.requestPayloads = template.requestPayloads;
-        request.requestOffsets = template.requestOffsets;
-        request.requestFieldStatistics = template.requestFieldStatistics;
-        request.requestTermStatistics = template.requestTermStatistics;
-        if (template.routing != null) request.setRouting(template.getRouting());
-        if (template.preference != null) request.setPreference(template.getPreference());
-        if (template.fields != null) request.setFields(template.getFields());
-        if (template.perFieldAnalyzer != null) request.setPerFieldAnalyzer(template.perFieldAnalyzer);
-        if (template.filterSettings != null) request.setFilterSettings(template.filterSettings);
-        return request;
-    }
-
-    /**
-     * Returns the index of the request
-     */
-    public String getIndex() {
-        return index;
-    }
-
-    /**
-     * Returns the type of the request
-     *
-     * @deprecated Types are in the process of being removed.
-     */
-    @Deprecated
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * Returns the id of the request
-     * can be NULL if there is no document ID
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Sets the fields for which term vectors information should be retrieved
-     */
-    public void setFields(String... fields) {
-        this.fields = fields;
-    }
-
-    public String[] getFields() {
-        return fields;
-    }
-
-    /**
-     * Sets whether to request term positions
-     */
-    public void setPositions(boolean positions) {
-        this.requestPositions = positions;
-    }
-
-    /**
-     * Sets whether to request term payloads
-     */
-    public void setPayloads(boolean payloads) {
-        this.requestPayloads = payloads;
-    }
-
-    /**
-     * Sets whether to request term offsets
-     */
-    public void setOffsets(boolean offsets) {
-        this.requestOffsets = offsets;
-    }
-
-    /**
-     * Sets whether to request field statistics
-     */
-    public void setFieldStatistics(boolean fieldStatistics) {
-        this.requestFieldStatistics = fieldStatistics;
-    }
-
-    /**
-     * Sets whether to request term statistics
-     */
-    public void setTermStatistics(boolean termStatistics) {
-        this.requestTermStatistics = termStatistics;
-    }
-
-    /**
-     * Sets different analyzers than the one at the fields
-     */
-    public void setPerFieldAnalyzer(Map<String, String> perFieldAnalyzer) {
-        this.perFieldAnalyzer = perFieldAnalyzer;
-    }
-
-    /**
-     * Sets conditions for terms filtering
-     */
-    public void setFilterSettings(Map<String, Integer> filterSettings) {
-        this.filterSettings = filterSettings;
-    }
-
-    /**
-     * Sets a routing to route a request to a particular shard
-     */
-    public void setRouting(String routing) {
-        this.routing = routing;
-    }
-
-    public String getRouting() {
-        return routing;
-    }
-
-    /**
-     * Set a preference of which shard copies to execute the request
-     */
-    public void setPreference(String preference) {
-        this.preference = preference;
-    }
-
-    public String getPreference() {
-        return preference;
-    }
-
-    /**
-     * Sets if the request should be realtime or near-realtime
-     */
-    public void setRealtime(boolean realtime) {
-        this.realtime = realtime;
-    }
-
-    /**
-     * Returns if the request is realtime(true) or near-realtime(false)
-     */
-    public boolean getRealtime() {
-        return realtime;
-    }
-
-    @Override
-    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
-        builder.startObject();
-        builder.field("_index", index);
-        if (type != null) {
-            builder.field("_type", type);
-        }
-        if (id != null) builder.field("_id", id);
-        if (fields != null) builder.field("fields", fields);
-        // set values only when different from defaults
-        if (requestPositions == false) builder.field("positions", false);
-        if (requestPayloads == false) builder.field("payloads", false);
-        if (requestOffsets == false) builder.field("offsets", false);
-        if (requestFieldStatistics == false) builder.field("field_statistics", false);
-        if (requestTermStatistics) builder.field("term_statistics", true);
-        if (perFieldAnalyzer != null) builder.field("per_field_analyzer", perFieldAnalyzer);
-
-        if (docBuilder != null) {
-            BytesReference doc = BytesReference.bytes(docBuilder);
-            try (InputStream stream = doc.streamInput()) {
-                builder.rawField("doc", stream, docBuilder.contentType());
-            }
-        }
-
-        if (filterSettings != null) {
-            builder.startObject("filter");
-            String[] filterSettingNames = {
-                "max_num_terms",
-                "min_term_freq",
-                "max_term_freq",
-                "min_doc_freq",
-                "max_doc_freq",
-                "min_word_length",
-                "max_word_length" };
-            for (String settingName : filterSettingNames) {
-                if (filterSettings.containsKey(settingName)) builder.field(settingName, filterSettings.get(settingName));
-            }
-            builder.endObject();
-        }
-        builder.endObject();
-        return builder;
-    }
-
-}

+ 0 - 468
client/rest-high-level/src/main/java/org/elasticsearch/client/core/TermVectorsResponse.java

@@ -1,468 +0,0 @@
-/*
- * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
- * or more contributor license agreements. Licensed under the Elastic License
- * 2.0 and the Server Side Public License, v 1; you may not use this file except
- * in compliance with, at your election, the Elastic License 2.0 or the Server
- * Side Public License, v 1.
- */
-
-package org.elasticsearch.client.core;
-
-import org.elasticsearch.core.Nullable;
-import org.elasticsearch.xcontent.ConstructingObjectParser;
-import org.elasticsearch.xcontent.ParseField;
-import org.elasticsearch.xcontent.XContentParser;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Objects;
-
-import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg;
-import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstructorArg;
-
-public class TermVectorsResponse {
-    private final String index;
-    private final String id;
-    private final long docVersion;
-    private final boolean found;
-    private final long tookInMillis;
-    private final List<TermVector> termVectorList;
-
-    public TermVectorsResponse(String index, String id, long version, boolean found, long tookInMillis, List<TermVector> termVectorList) {
-        this.index = index;
-        this.id = id;
-        this.docVersion = version;
-        this.found = found;
-        this.tookInMillis = tookInMillis;
-        this.termVectorList = termVectorList;
-    }
-
-    private static final ConstructingObjectParser<TermVectorsResponse, Void> PARSER = new ConstructingObjectParser<>(
-        "term_vectors",
-        true,
-        args -> {
-            // as the response comes from server, we are sure that args[5] will be a list of TermVector
-            @SuppressWarnings("unchecked")
-            List<TermVector> termVectorList = (List<TermVector>) args[5];
-            if (termVectorList != null) {
-                Collections.sort(termVectorList, Comparator.comparing(TermVector::getFieldName));
-            }
-            return new TermVectorsResponse(
-                (String) args[0],
-                (String) args[1],
-                (long) args[2],
-                (boolean) args[3],
-                (long) args[4],
-                termVectorList
-            );
-        }
-    );
-
-    static {
-        PARSER.declareString(constructorArg(), new ParseField("_index"));
-        PARSER.declareString(optionalConstructorArg(), new ParseField("_id"));
-        PARSER.declareLong(constructorArg(), new ParseField("_version"));
-        PARSER.declareBoolean(constructorArg(), new ParseField("found"));
-        PARSER.declareLong(constructorArg(), new ParseField("took"));
-        PARSER.declareNamedObjects(
-            optionalConstructorArg(),
-            (p, c, fieldName) -> TermVector.fromXContent(p, fieldName),
-            new ParseField("term_vectors")
-        );
-    }
-
-    public static TermVectorsResponse fromXContent(XContentParser parser) {
-        return PARSER.apply(parser, null);
-    }
-
-    /**
-     * Returns the index for the response
-     */
-    public String getIndex() {
-        return index;
-    }
-
-    /**
-     * Returns the id of the request
-     * can be NULL if there is no document ID
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * Returns if the document is found
-     * always <code>true</code> for artificial documents
-     */
-    public boolean getFound() {
-        return found;
-    }
-
-    /**
-     * Returns the document version
-     */
-    public long getDocVersion() {
-        return docVersion;
-    }
-
-    /**
-     * Returns the time that a request took in milliseconds
-     */
-    public long getTookInMillis() {
-        return tookInMillis;
-    }
-
-    /**
-     * Returns the list of term vectors
-     */
-    public List<TermVector> getTermVectorsList() {
-        return termVectorList;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) return true;
-        if ((obj instanceof TermVectorsResponse) == false) return false;
-        TermVectorsResponse other = (TermVectorsResponse) obj;
-        return index.equals(other.index)
-            && Objects.equals(id, other.id)
-            && docVersion == other.docVersion
-            && found == other.found
-            && tookInMillis == other.tookInMillis
-            && Objects.equals(termVectorList, other.termVectorList);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(index, id, docVersion, found, tookInMillis, termVectorList);
-    }
-
-    public static final class TermVector {
-
-        private static final ConstructingObjectParser<TermVector, String> PARSER = new ConstructingObjectParser<>(
-            "term_vector",
-            true,
-            (args, ctxFieldName) -> {
-                // as the response comes from server, we are sure that args[1] will be a list of Term
-                @SuppressWarnings("unchecked")
-                List<Term> terms = (List<Term>) args[1];
-                if (terms != null) {
-                    Collections.sort(terms, Comparator.comparing(Term::getTerm));
-                }
-                return new TermVector(ctxFieldName, (FieldStatistics) args[0], terms);
-            }
-        );
-
-        static {
-            PARSER.declareObject(optionalConstructorArg(), (p, c) -> FieldStatistics.fromXContent(p), new ParseField("field_statistics"));
-            PARSER.declareNamedObjects(optionalConstructorArg(), (p, c, term) -> Term.fromXContent(p, term), new ParseField("terms"));
-        }
-
-        private final String fieldName;
-        @Nullable
-        private final FieldStatistics fieldStatistics;
-        @Nullable
-        private final List<Term> terms;
-
-        public TermVector(String fieldName, FieldStatistics fieldStatistics, List<Term> terms) {
-            this.fieldName = fieldName;
-            this.fieldStatistics = fieldStatistics;
-            this.terms = terms;
-        }
-
-        public static TermVector fromXContent(XContentParser parser, String fieldName) {
-            return PARSER.apply(parser, fieldName);
-        }
-
-        /**
-         * Returns the field name of the current term vector
-         */
-        public String getFieldName() {
-            return fieldName;
-        }
-
-        /**
-         * Returns the list of terms for the current term vector
-         */
-        public List<Term> getTerms() {
-            return terms;
-        }
-
-        /**
-         * Returns the field statistics for the current field
-         */
-        public FieldStatistics getFieldStatistics() {
-            return fieldStatistics;
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) return true;
-            if ((obj instanceof TermVector) == false) return false;
-            TermVector other = (TermVector) obj;
-            return fieldName.equals(other.fieldName)
-                && Objects.equals(fieldStatistics, other.fieldStatistics)
-                && Objects.equals(terms, other.terms);
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hash(fieldName, fieldStatistics, terms);
-        }
-
-        // Class containing a general field statistics for the field
-        public static final class FieldStatistics {
-
-            private static final ConstructingObjectParser<FieldStatistics, Void> PARSER = new ConstructingObjectParser<>(
-                "field_statistics",
-                true,
-                args -> { return new FieldStatistics((long) args[0], (int) args[1], (long) args[2]); }
-            );
-
-            static {
-                PARSER.declareLong(constructorArg(), new ParseField("sum_doc_freq"));
-                PARSER.declareInt(constructorArg(), new ParseField("doc_count"));
-                PARSER.declareLong(constructorArg(), new ParseField("sum_ttf"));
-            }
-            private final long sumDocFreq;
-            private final int docCount;
-            private final long sumTotalTermFreq;
-
-            public FieldStatistics(long sumDocFreq, int docCount, long sumTotalTermFreq) {
-                this.sumDocFreq = sumDocFreq;
-                this.docCount = docCount;
-                this.sumTotalTermFreq = sumTotalTermFreq;
-            }
-
-            public static FieldStatistics fromXContent(XContentParser parser) {
-                return PARSER.apply(parser, null);
-            }
-
-            /*
-             * Returns how many documents this field contains
-             */
-            public int getDocCount() {
-                return docCount;
-            }
-
-            /**
-             * Returns the sum of document frequencies for all terms in this field
-             */
-            public long getSumDocFreq() {
-                return sumDocFreq;
-            }
-
-            /**
-             * Returns the sum of total term frequencies of all terms in this field
-             */
-            public long getSumTotalTermFreq() {
-                return sumTotalTermFreq;
-            }
-
-            @Override
-            public boolean equals(Object obj) {
-                if (this == obj) return true;
-                if ((obj instanceof FieldStatistics) == false) return false;
-                FieldStatistics other = (FieldStatistics) obj;
-                return docCount == other.docCount && sumDocFreq == other.sumDocFreq && sumTotalTermFreq == other.sumTotalTermFreq;
-            }
-
-            @Override
-            public int hashCode() {
-                return Objects.hash(docCount, sumDocFreq, sumTotalTermFreq);
-            }
-        }
-
-        public static final class Term {
-            private static final ConstructingObjectParser<Term, String> PARSER = new ConstructingObjectParser<>(
-                "token",
-                true,
-                (args, ctxTerm) -> {
-                    // as the response comes from server, we are sure that args[4] will be a list of Token
-                    @SuppressWarnings("unchecked")
-                    List<Token> tokens = (List<Token>) args[4];
-                    if (tokens != null) {
-                        Collections.sort(
-                            tokens,
-                            Comparator.comparing(Token::getPosition, Comparator.nullsFirst(Integer::compareTo))
-                                .thenComparing(Token::getStartOffset, Comparator.nullsFirst(Integer::compareTo))
-                                .thenComparing(Token::getEndOffset, Comparator.nullsFirst(Integer::compareTo))
-                        );
-                    }
-                    return new Term(ctxTerm, (int) args[0], (Integer) args[1], (Long) args[2], (Float) args[3], tokens);
-                }
-            );
-            static {
-                PARSER.declareInt(constructorArg(), new ParseField("term_freq"));
-                PARSER.declareInt(optionalConstructorArg(), new ParseField("doc_freq"));
-                PARSER.declareLong(optionalConstructorArg(), new ParseField("ttf"));
-                PARSER.declareFloat(optionalConstructorArg(), new ParseField("score"));
-                PARSER.declareObjectArray(optionalConstructorArg(), (p, c) -> Token.fromXContent(p), new ParseField("tokens"));
-            }
-
-            private final String term;
-            private final int termFreq;
-            @Nullable
-            private final Integer docFreq;
-            @Nullable
-            private final Long totalTermFreq;
-            @Nullable
-            private final Float score;
-            @Nullable
-            private final List<Token> tokens;
-
-            public Term(String term, int termFreq, Integer docFreq, Long totalTermFreq, Float score, List<Token> tokens) {
-                this.term = term;
-                this.termFreq = termFreq;
-                this.docFreq = docFreq;
-                this.totalTermFreq = totalTermFreq;
-                this.score = score;
-                this.tokens = tokens;
-            }
-
-            public static Term fromXContent(XContentParser parser, String term) {
-                return PARSER.apply(parser, term);
-            }
-
-            /**
-             * Returns the string representation of the term
-             */
-            public String getTerm() {
-                return term;
-            }
-
-            /**
-             * Returns term frequency - the number of times this term occurs in the current document
-             */
-            public int getTermFreq() {
-                return termFreq;
-            }
-
-            /**
-             * Returns document frequency - the number of documents in the index that contain this term
-             */
-            public Integer getDocFreq() {
-                return docFreq;
-            }
-
-            /**
-             * Returns total term frequency - the number of times this term occurs across all documents
-             */
-            public Long getTotalTermFreq() {
-                return totalTermFreq;
-            }
-
-            /**
-             * Returns tf-idf score, if the request used some form of terms filtering
-             */
-            public Float getScore() {
-                return score;
-            }
-
-            /**
-             * Returns a list of tokens for the term
-             */
-            public List<Token> getTokens() {
-                return tokens;
-            }
-
-            @Override
-            public boolean equals(Object obj) {
-                if (this == obj) return true;
-                if ((obj instanceof Term) == false) return false;
-                Term other = (Term) obj;
-                return term.equals(other.term)
-                    && termFreq == other.termFreq
-                    && Objects.equals(docFreq, other.docFreq)
-                    && Objects.equals(totalTermFreq, other.totalTermFreq)
-                    && Objects.equals(score, other.score)
-                    && Objects.equals(tokens, other.tokens);
-            }
-
-            @Override
-            public int hashCode() {
-                return Objects.hash(term, termFreq, docFreq, totalTermFreq, score, tokens);
-            }
-        }
-
-        public static final class Token {
-
-            private static final ConstructingObjectParser<Token, Void> PARSER = new ConstructingObjectParser<>(
-                "token",
-                true,
-                args -> { return new Token((Integer) args[0], (Integer) args[1], (Integer) args[2], (String) args[3]); }
-            );
-            static {
-                PARSER.declareInt(optionalConstructorArg(), new ParseField("start_offset"));
-                PARSER.declareInt(optionalConstructorArg(), new ParseField("end_offset"));
-                PARSER.declareInt(optionalConstructorArg(), new ParseField("position"));
-                PARSER.declareString(optionalConstructorArg(), new ParseField("payload"));
-            }
-
-            @Nullable
-            private final Integer startOffset;
-            @Nullable
-            private final Integer endOffset;
-            @Nullable
-            private final Integer position;
-            @Nullable
-            private final String payload;
-
-            public Token(Integer startOffset, Integer endOffset, Integer position, String payload) {
-                this.startOffset = startOffset;
-                this.endOffset = endOffset;
-                this.position = position;
-                this.payload = payload;
-            }
-
-            public static Token fromXContent(XContentParser parser) {
-                return PARSER.apply(parser, null);
-            }
-
-            /**
-             * Returns the start offset of the token in the document's field
-             */
-            public Integer getStartOffset() {
-                return startOffset;
-            }
-
-            /**
-             * Returns the end offset of the token in the document's field
-             */
-            public Integer getEndOffset() {
-                return endOffset;
-            }
-
-            /**
-             * Returns the position of the token in the document's field
-             */
-            public Integer getPosition() {
-                return position;
-            }
-
-            /**
-             * Returns the payload of the token or <code>null</code> if the payload doesn't exist
-             */
-            public String getPayload() {
-                return payload;
-            }
-
-            @Override
-            public boolean equals(Object obj) {
-                if (this == obj) return true;
-                if ((obj instanceof Token) == false) return false;
-                Token other = (Token) obj;
-                return Objects.equals(startOffset, other.startOffset)
-                    && Objects.equals(endOffset, other.endOffset)
-                    && Objects.equals(position, other.position)
-                    && Objects.equals(payload, other.payload);
-            }
-
-            @Override
-            public int hashCode() {
-                return Objects.hash(startOffset, endOffset, position, payload);
-            }
-        }
-    }
-}