Browse Source

Remove the deprecated _termvector endpoint. (#36131)

Julie Tibshirani 6 years ago
parent
commit
59ee8b5c69

+ 0 - 3
docs/reference/docs/termvectors.asciidoc

@@ -27,9 +27,6 @@ or by adding the requested fields in the request body (see
 example below). Fields can also be specified with wildcards
 in similar way to the <<query-dsl-multi-match-query,multi match query>>
 
-[WARNING]
-Note that the usage of `/_termvector` is deprecated in 2.0, and replaced by `/_termvectors`.
-
 [float]
 === Return values
 

+ 7 - 0
docs/reference/migration/migrate_7_0/api.asciidoc

@@ -119,3 +119,10 @@ while now an exception is thrown.
 
 The deprecated graph endpoints (those with `/_graph/_explore`) have been
 removed.
+
+
+[float]
+==== Deprecated `_termvector` endpoint removed
+
+The `_termvector` endpoint was deprecated in 2.0 and has now been removed.
+The endpoint `_termvectors` (plural) should be used instead.

+ 7 - 1
docs/reference/migration/migrate_7_0/java.asciidoc

@@ -32,4 +32,10 @@ was moved to `org.elasticsearch.search.aggregations.PipelineAggregationBuilders`
 ==== `Retry.withBackoff` methods with `Settings` removed
 
 The variants of `Retry.withBackoff` that included `Settings` have been removed
-because `Settings` is no longer needed.
+because `Settings` is no longer needed.
+
+[float]
+==== Deprecated method `Client#termVector` removed
+
+The client method `termVector`, deprecated in 2.0, has been removed. The method
+`termVectors` (plural) should be used instead.

+ 0 - 33
server/src/main/java/org/elasticsearch/client/Client.java

@@ -370,39 +370,6 @@ public interface Client extends ElasticsearchClient, Releasable {
      */
     TermVectorsRequestBuilder prepareTermVectors(String index, String type, String id);
 
-    /**
-     * An action that returns the term vectors for a specific document.
-     *
-     * @param request The term vector request
-     * @return The response future
-     */
-    @Deprecated
-    ActionFuture<TermVectorsResponse> termVector(TermVectorsRequest request);
-
-    /**
-     * An action that returns the term vectors for a specific document.
-     *
-     * @param request The term vector request
-     */
-    @Deprecated
-    void termVector(TermVectorsRequest request, ActionListener<TermVectorsResponse> listener);
-
-    /**
-     * Builder for the term vector request.
-     */
-    @Deprecated
-    TermVectorsRequestBuilder prepareTermVector();
-
-    /**
-     * Builder for the term vector request.
-     *
-     * @param index The index to load the document from
-     * @param type  The type of the document
-     * @param id    The id of the document
-     */
-    @Deprecated
-    TermVectorsRequestBuilder prepareTermVector(String index, String type, String id);
-
     /**
      * Multi get term vectors.
      */

+ 0 - 24
server/src/main/java/org/elasticsearch/client/support/AbstractClient.java

@@ -581,30 +581,6 @@ public abstract class AbstractClient implements Client {
         return new TermVectorsRequestBuilder(this, TermVectorsAction.INSTANCE, index, type, id);
     }
 
-    @Deprecated
-    @Override
-    public ActionFuture<TermVectorsResponse> termVector(final TermVectorsRequest request) {
-        return termVectors(request);
-    }
-
-    @Deprecated
-    @Override
-    public void termVector(final TermVectorsRequest request, final ActionListener<TermVectorsResponse> listener) {
-        termVectors(request, listener);
-    }
-
-    @Deprecated
-    @Override
-    public TermVectorsRequestBuilder prepareTermVector() {
-        return prepareTermVectors();
-    }
-
-    @Deprecated
-    @Override
-    public TermVectorsRequestBuilder prepareTermVector(String index, String type, String id) {
-        return prepareTermVectors(index, type, id);
-    }
-
     @Override
     public ActionFuture<MultiTermVectorsResponse> multiTermVectors(final MultiTermVectorsRequest request) {
         return execute(MultiTermVectorsAction.INSTANCE, request);

+ 4 - 12
server/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java

@@ -19,11 +19,9 @@
 
 package org.elasticsearch.rest.action.document;
 
-import org.apache.logging.log4j.LogManager;
 import org.elasticsearch.action.termvectors.TermVectorsRequest;
 import org.elasticsearch.client.node.NodeClient;
 import org.elasticsearch.common.Strings;
-import org.elasticsearch.common.logging.DeprecationLogger;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.xcontent.XContentParser;
 import org.elasticsearch.index.VersionType;
@@ -45,19 +43,13 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
  * TermVectorsRequest.
  */
 public class RestTermVectorsAction extends BaseRestHandler {
-    private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
-        LogManager.getLogger(RestTermVectorsAction.class));
 
     public RestTermVectorsAction(Settings settings, RestController controller) {
         super(settings);
-        controller.registerWithDeprecatedHandler(GET, "/{index}/{type}/_termvectors", this,
-            GET, "/{index}/{type}/_termvector", deprecationLogger);
-        controller.registerWithDeprecatedHandler(POST, "/{index}/{type}/_termvectors", this,
-            POST, "/{index}/{type}/_termvector", deprecationLogger);
-        controller.registerWithDeprecatedHandler(GET, "/{index}/{type}/{id}/_termvectors", this,
-            GET, "/{index}/{type}/{id}/_termvector", deprecationLogger);
-        controller.registerWithDeprecatedHandler(POST, "/{index}/{type}/{id}/_termvectors", this,
-            POST, "/{index}/{type}/{id}/_termvector", deprecationLogger);
+        controller.registerHandler(GET, "/{index}/{type}/_termvectors", this);
+        controller.registerHandler(POST, "/{index}/{type}/_termvectors", this);
+        controller.registerHandler(GET, "/{index}/{type}/{id}/_termvectors", this);
+        controller.registerHandler(POST, "/{index}/{type}/{id}/_termvectors", this);
     }
 
     @Override

+ 2 - 2
server/src/test/java/org/elasticsearch/action/termvectors/GetTermVectorsIT.java

@@ -506,7 +506,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
         for (int id = 0; id < content.length; id++) {
             Fields[] fields = new Fields[2];
             for (int j = 0; j < indexNames.length; j++) {
-                TermVectorsResponse resp = client().prepareTermVector(indexNames[j], "type1", String.valueOf(id))
+                TermVectorsResponse resp = client().prepareTermVectors(indexNames[j], "type1", String.valueOf(id))
                         .setOffsets(true)
                         .setPositions(true)
                         .setSelectedFields("field1")
@@ -1069,7 +1069,7 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
         for (int id = 0; id < content.length; id++) {
             Fields[] fields = new Fields[2];
             for (int j = 0; j < indexNames.length; j++) {
-                TermVectorsResponse resp = client().prepareTermVector(indexNames[j], "type1", String.valueOf(id))
+                TermVectorsResponse resp = client().prepareTermVectors(indexNames[j], "type1", String.valueOf(id))
                     .setOffsets(true)
                     .setPositions(true)
                     .setSelectedFields("field1", "field2")

+ 0 - 67
server/src/test/java/org/elasticsearch/rest/action/document/RestTermVectorsActionTests.java

@@ -1,67 +0,0 @@
-/*
- * Licensed to Elasticsearch under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.elasticsearch.rest.action.document;
-
-import org.elasticsearch.client.node.NodeClient;
-import org.elasticsearch.common.settings.Settings;
-import org.elasticsearch.common.util.concurrent.ThreadContext;
-import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
-import org.elasticsearch.rest.RestChannel;
-import org.elasticsearch.rest.RestController;
-import org.elasticsearch.rest.RestRequest;
-import org.elasticsearch.rest.RestRequest.Method;
-import org.elasticsearch.test.ESTestCase;
-import org.elasticsearch.test.rest.FakeRestChannel;
-import org.elasticsearch.test.rest.FakeRestRequest;
-import org.elasticsearch.usage.UsageService;
-
-import java.util.Collections;
-
-import static org.mockito.Mockito.mock;
-
-public class RestTermVectorsActionTests extends ESTestCase {
-    private RestController controller;
-
-    public void setUp() throws Exception {
-        super.setUp();
-        controller = new RestController(Collections.emptySet(), null,
-            mock(NodeClient.class),
-            new NoneCircuitBreakerService(),
-            new UsageService());
-        new RestTermVectorsAction(Settings.EMPTY, controller);
-    }
-
-    public void testDeprecatedEndpoint() {
-        RestRequest request = new FakeRestRequest.Builder(xContentRegistry())
-            .withMethod(Method.POST)
-            .withPath("/some_index/some_type/some_id/_termvector")
-            .build();
-
-        performRequest(request);
-        assertWarnings("[POST /{index}/{type}/{id}/_termvector] is deprecated! Use" +
-            " [POST /{index}/{type}/{id}/_termvectors] instead.");
-    }
-
-    private void performRequest(RestRequest request) {
-        RestChannel channel = new FakeRestChannel(request, false, 1);
-        ThreadContext threadContext = new ThreadContext(Settings.EMPTY);
-        controller.dispatchRequest(request, channel, threadContext);
-    }
-}

+ 2 - 2
x-pack/plugin/security/src/test/java/org/elasticsearch/integration/IndexPrivilegeTests.java

@@ -492,13 +492,13 @@ public class IndexPrivilegeTests extends AbstractPrivilegeTestCase {
                     assertAccessIsAllowed("admin", "GET", "/" + index + "/_search");
                     assertAccessIsAllowed("admin", "GET", "/" + index + "/foo/1");
                     assertAccessIsAllowed(user, "GET", "/" + index + "/foo/1/_explain", "{ \"query\" : { \"match_all\" : {} } }");
-                    assertAccessIsAllowed(user, "GET", "/" + index + "/foo/1/_termvector");
+                    assertAccessIsAllowed(user, "GET", "/" + index + "/foo/1/_termvectors");
                     assertUserIsAllowed(user, "search", index);
                 } else {
                     assertAccessIsDenied(user, "GET", "/" + index + "/_count");
                     assertAccessIsDenied(user, "GET", "/" + index + "/_search");
                     assertAccessIsDenied(user, "GET", "/" + index + "/foo/1/_explain", "{ \"query\" : { \"match_all\" : {} } }");
-                    assertAccessIsDenied(user, "GET", "/" + index + "/foo/1/_termvector");
+                    assertAccessIsDenied(user, "GET", "/" + index + "/foo/1/_termvectors");
                     assertUserIsDenied(user, "search", index);
                 }
                 break;