diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/GraphRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/GraphRequestConverters.java index 69a70bd97f17a..48009810cf3b0 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/GraphRequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/GraphRequestConverters.java @@ -29,7 +29,7 @@ final class GraphRequestConverters { private GraphRequestConverters() {} static Request explore(GraphExploreRequest exploreRequest) throws IOException { - String endpoint = RequestConverters.endpoint(exploreRequest.indices(), exploreRequest.types(), "_graph/explore"); + String endpoint = RequestConverters.endpoint(exploreRequest.indices(), "_graph/explore"); Request request = new Request(HttpGet.METHOD_NAME, endpoint); request.setEntity(RequestConverters.createEntity(exploreRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)); return request; diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java index 5a0a4c2a92089..c3230a75a58de 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/graph/GraphExploreRequest.java @@ -47,7 +47,6 @@ public class GraphExploreRequest implements IndicesRequest.Replaceable, ToXConte public static final String NO_VERTICES_ERROR_MESSAGE = "Graph explore hop must have at least one VertexRequest"; private String[] indices = Strings.EMPTY_ARRAY; private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, false, true, false); - private String[] types = Strings.EMPTY_ARRAY; private String routing; private TimeValue timeout; @@ -106,31 +105,6 @@ public GraphExploreRequest indicesOptions(IndicesOptions indicesOptions) { return this; } - /** - * The document types to execute the explore 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 String[] types() { - return this.types; - } - - /** - * The document types to execute the explore request 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 GraphExploreRequest types(String... types) { - this.types = types; - return this; - } - public String routing() { return this.routing; } @@ -154,7 +128,7 @@ public TimeValue timeout() { * operations involved in each hop are limited to the remaining time * available but can still overrun due to the nature of their "best efforts" * timeout support. When a timeout occurs partial results are returned. - * + * * @param timeout * a {@link TimeValue} object which determines the maximum length * of time to spend exploring @@ -174,7 +148,7 @@ public GraphExploreRequest timeout(String timeout) { @Override public String toString() { - return "graph explore [" + Arrays.toString(indices) + "][" + Arrays.toString(types) + "]"; + return "graph explore [" + Arrays.toString(indices) + "]"; } /** @@ -190,7 +164,7 @@ public String toString() { * better with smaller samples as there are less look-ups required for * background frequencies of terms found in the documents *
- * + * * @param maxNumberOfDocsPerHop * shard-level sample size in documents */ @@ -231,7 +205,7 @@ public int maxDocsPerDiversityValue() { * default value is true which means terms are selected based on * significance (see the {@link SignificantTerms} aggregation) rather than * popularity (using the {@link TermsAggregator}). - * + * * @param value * true if the significant_terms algorithm should be used. */ @@ -246,7 +220,7 @@ public boolean useSignificance() { /** * Return detailed information about vertex frequencies as part of JSON * results - defaults to false - * + * * @param value * true if detailed information is required in JSON responses */ @@ -262,7 +236,7 @@ public boolean returnDetailedInfo() { * Add a stage in the graph exploration. Each hop represents a stage of * querying elasticsearch to identify terms which can then be connnected to * other terms in a subsequent hop. - * + * * @param guidingQuery * optional choice of query which influences which documents are * considered in this stage @@ -316,7 +290,7 @@ public float getBoost() { @Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(); - + builder.startObject("controls"); { if (sampleSize != SamplerAggregationBuilder.DEFAULT_SHARD_SAMPLE_SIZE) { diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/GrapRequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/GraphRequestConvertersTests.java similarity index 93% rename from client/rest-high-level/src/test/java/org/elasticsearch/client/GrapRequestConvertersTests.java rename to client/rest-high-level/src/test/java/org/elasticsearch/client/GraphRequestConvertersTests.java index 7c653bdee384d..c45552f0debfc 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/GrapRequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/GraphRequestConvertersTests.java @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.is; -public class GrapRequestConvertersTests extends ESTestCase { +public class GraphRequestConvertersTests extends ESTestCase { public void testGraphExplore() throws Exception { MapVery large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or + * significant connections between terms. + *
Very large values (many thousands) are not recommended with loosely defined queries (fuzzy queries or * those with many OR clauses). * This is because any useful signals in the best documents are diluted with irrelevant noise from low-quality matches. - * Performance is also typically better with smaller samples as there are less look-ups required for background frequencies - * of terms found in the documents + * Performance is also typically better with smaller samples as there are less look-ups required for background frequencies + * of terms found in the documents *
- * + * * @param maxNumberOfDocsPerHop the shard-level sample size in documents */ public GraphExploreRequestBuilder sampleSize(int maxNumberOfDocsPerHop) { diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index b4cad83951537..40331f168c2d3 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -40,8 +40,6 @@ public class RestGraphAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGraphAction.class)); - public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + - " Specifying types in graph requests is deprecated."; public static final ParseField TIMEOUT_FIELD = new ParseField("timeout"); public static final ParseField SIGNIFICANCE_FIELD = new ParseField("use_significance"); @@ -65,20 +63,12 @@ public class RestGraphAction extends BaseRestHandler { public RestGraphAction(RestController controller) { // TODO: remove deprecated endpoint in 8.0.0 controller.registerWithDeprecatedHandler( - GET, "/{index}/_graph/explore", this, - GET, "/{index}/_xpack/graph/_explore", deprecationLogger); + GET, "/{index}/_graph/explore", this, + GET, "/{index}/_xpack/graph/_explore", deprecationLogger); // TODO: remove deprecated endpoint in 8.0.0 controller.registerWithDeprecatedHandler( - POST, "/{index}/_graph/explore", this, - POST, "/{index}/_xpack/graph/_explore", deprecationLogger); - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/{index}/{type}/_graph/explore", this, - GET, "/{index}/{type}/_xpack/graph/_explore", deprecationLogger); - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/{index}/{type}/_graph/explore", this, - POST, "/{index}/{type}/_xpack/graph/_explore", deprecationLogger); + POST, "/{index}/_graph/explore", this, + POST, "/{index}/_xpack/graph/_explore", deprecationLogger); } @Override @@ -111,10 +101,6 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC parseHop(parser, currentHop, graphRequest); } - if (request.hasParam("type")) { - deprecationLogger.deprecatedAndMaybeLog("graph_with_types", TYPES_DEPRECATION_MESSAGE); - graphRequest.types(Strings.splitStringByCommaToArray(request.param("type"))); - } return channel -> client.execute(INSTANCE, graphRequest, new RestToXContentListener<>(channel)); } diff --git a/x-pack/plugin/graph/src/test/java/org/elasticsearch/xpack/graph/rest/action/RestGraphActionTests.java b/x-pack/plugin/graph/src/test/java/org/elasticsearch/xpack/graph/rest/action/RestGraphActionTests.java deleted file mode 100644 index fb91e6fc5ee8a..0000000000000 --- a/x-pack/plugin/graph/src/test/java/org/elasticsearch/xpack/graph/rest/action/RestGraphActionTests.java +++ /dev/null @@ -1,34 +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; - * you may not use this file except in compliance with the Elastic License. - */ - -package org.elasticsearch.xpack.graph.rest.action; - -import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.test.rest.FakeRestRequest; -import org.elasticsearch.test.rest.RestActionTestCase; -import org.junit.Before; - -public class RestGraphActionTests extends RestActionTestCase { - - @Before - public void setUpAction() { - new RestGraphAction(controller()); - } - - public void testTypeInPath() { - RestRequest request = new FakeRestRequest.Builder(xContentRegistry()) - .withMethod(RestRequest.Method.GET) - .withPath("/some_index/some_type/_graph/explore") - .withContent(new BytesArray("{}"), XContentType.JSON) - .build(); - - dispatchRequest(request); - assertWarnings(RestGraphAction.TYPES_DEPRECATION_MESSAGE); - } - -} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/graph.explore.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/graph.explore.json index aa8177bb8621d..253ab219d5280 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/graph.explore.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/graph.explore.json @@ -7,39 +7,17 @@ "url":{ "paths":[ { - "path":"/{index}/_graph/explore", - "methods":[ + "path": "/{index}/_graph/explore", + "methods": [ "GET", "POST" ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + "parts": { + "index": { + "type": "list", + "description": "A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" } } - }, - { - "path":"/{index}/{type}/_graph/explore", - "methods":[ - "GET", - "POST" - ], - "parts":{ - "index":{ - "type":"list", - "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" - }, - "type":{ - "type":"list", - "description":"A comma-separated list of document types to search; leave empty to perform the operation on all types", - "deprecated":true - } - }, - "deprecated":{ - "version":"7.0.0", - "description":"Specifying types in urls has been deprecated" - } } ] },