Skip to content

Commit

Permalink
Remove the deprecated _termvector endpoint. (#36131)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtibshirani authored and spinscale committed Dec 4, 2018
1 parent 94832de commit 5926e4b
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 144 deletions.
3 changes: 0 additions & 3 deletions docs/reference/docs/termvectors.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions docs/reference/migration/migrate_7_0/api.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 7 additions & 1 deletion docs/reference/migration/migrate_7_0/java.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
33 changes: 0 additions & 33 deletions server/src/main/java/org/elasticsearch/client/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,30 +581,6 @@ public TermVectorsRequestBuilder prepareTermVectors(String index, String type, S
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -45,19 +43,13 @@
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public void testDuelWithAndWithoutTermVectors() throws IOException, ExecutionExc
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")
Expand Down Expand Up @@ -1069,7 +1069,7 @@ public void testWithKeywordAndNormalizer() throws IOException, ExecutionExceptio
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")
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ private void assertUserExecutes(String user, String action, String index, boolea
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;
Expand Down

0 comments on commit 5926e4b

Please sign in to comment.