Skip to content

Removes tpyed endpoints for msearch and mtermvector APIs #41674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@

package org.elasticsearch.script.mustache;

import org.apache.logging.log4j.LogManager;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController;
Expand All @@ -40,10 +38,6 @@
import static org.elasticsearch.rest.RestRequest.Method.POST;

public class RestMultiSearchTemplateAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestMultiSearchTemplateAction.class));
static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in multi search template requests is deprecated.";

private static final Set<String> RESPONSE_PARAMS;

Expand All @@ -65,10 +59,6 @@ public RestMultiSearchTemplateAction(Settings settings, RestController controlle
controller.registerHandler(POST, "/_msearch/template", this);
controller.registerHandler(GET, "/{index}/_msearch/template", this);
controller.registerHandler(POST, "/{index}/_msearch/template", this);

// Deprecated typed endpoints.
controller.registerHandler(GET, "/{index}/{type}/_msearch/template", this);
controller.registerHandler(POST, "/{index}/{type}/_msearch/template", this);
}

@Override
Expand All @@ -79,14 +69,6 @@ public String getName() {
@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
MultiSearchTemplateRequest multiRequest = parseRequest(request, allowExplicitIndex);

// Emit a single deprecation message if any search template contains types.
for (SearchTemplateRequest searchTemplateRequest : multiRequest.requests()) {
if (searchTemplateRequest.getRequest().types().length > 0) {
deprecationLogger.deprecatedAndMaybeLog("msearch_with_types", TYPES_DEPRECATION_MESSAGE);
break;
}
}
return channel -> client.execute(MultiSearchTemplateAction.INSTANCE, multiRequest, new RestToXContentListener<>(channel));
}

Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions rest-api-spec/src/main/resources/rest-api-spec/api/msearch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,10 @@
"url": {
"path": "/_msearch",
"paths": ["/_msearch", "/{index}/_msearch"],
"deprecated_paths" : [
{
"version" : "7.0.0",
"path" : "/{index}/{type}/_msearch",
"description" : "Specifying types in urls has been deprecated"
}
],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to use as default"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to use as default"
}
},
"params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,10 @@
"url": {
"path": "/_msearch/template",
"paths": ["/_msearch/template", "/{index}/_msearch/template"],
"deprecated_paths" : [
{
"version" : "7.0.0",
"path" : "/{index}/{type}/_msearch/template",
"description" : "Specifying types in urls has been deprecated"
}
],
"parts": {
"index": {
"type" : "list",
"description" : "A comma-separated list of index names to use as default"
},
"type": {
"type" : "list",
"description" : "A comma-separated list of document types to use as default"
}
},
"params": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,10 @@
"url" : {
"path" : "/_mtermvectors",
"paths" : ["/_mtermvectors", "/{index}/_mtermvectors"],
"deprecated_paths" : [
{
"version" : "7.0.0",
"path" : "/{index}/{type}/_mtermvectors",
"description" : "Specifying types in urls has been deprecated"
}
],
"parts" : {
"index" : {
"type" : "string",
"description" : "The index in which the document resides."
},
"type" : {
"type" : "string",
"description" : "The type of the document."
}
},
"params" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@

package org.elasticsearch.rest.action.document;

import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.termvectors.MultiTermVectorsRequest;
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.index.mapper.MapperService;
import org.elasticsearch.rest.BaseRestHandler;
Expand All @@ -38,21 +36,13 @@
import static org.elasticsearch.rest.RestRequest.Method.POST;

public class RestMultiTermVectorsAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestTermVectorsAction.class));
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " +
"Specifying types in multi term vector requests is deprecated.";

public RestMultiTermVectorsAction(Settings settings, RestController controller) {
super(settings);
controller.registerHandler(GET, "/_mtermvectors", this);
controller.registerHandler(POST, "/_mtermvectors", this);
controller.registerHandler(GET, "/{index}/_mtermvectors", this);
controller.registerHandler(POST, "/{index}/_mtermvectors", this);

// Deprecated typed endpoints.
controller.registerHandler(GET, "/{index}/{type}/_mtermvectors", this);
controller.registerHandler(POST, "/{index}/{type}/_mtermvectors", this);
}

@Override
Expand All @@ -66,12 +56,8 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
TermVectorsRequest template = new TermVectorsRequest()
.index(request.param("index"));

if (request.hasParam("type")) {
deprecationLogger.deprecatedAndMaybeLog("mtermvectors_with_types", TYPES_DEPRECATION_MESSAGE);
template.type(request.param("type"));
} else {
template.type(MapperService.SINGLE_MAPPING_NAME);
}

template.type(MapperService.SINGLE_MAPPING_NAME);

RestTermVectorsAction.readURIParameters(template, request);
multiTermVectorsRequest.ids(Strings.commaDelimitedListToStringArray(request.param("ids")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.elasticsearch.rest.action.search;

import org.apache.logging.log4j.LogManager;
import org.elasticsearch.action.search.MultiSearchRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand All @@ -28,7 +27,6 @@
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.collect.Tuple;
import org.elasticsearch.common.logging.DeprecationLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContent;
import org.elasticsearch.common.xcontent.XContentParser;
Expand All @@ -50,10 +48,6 @@
import static org.elasticsearch.rest.RestRequest.Method.POST;

public class RestMultiSearchAction extends BaseRestHandler {
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(
LogManager.getLogger(RestMultiSearchAction.class));
static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" +
" Specifying types in multi search requests is deprecated.";

private static final Set<String> RESPONSE_PARAMS;

Expand All @@ -73,10 +67,6 @@ public RestMultiSearchAction(Settings settings, RestController controller) {
controller.registerHandler(GET, "/{index}/_msearch", this);
controller.registerHandler(POST, "/{index}/_msearch", this);

// Deprecated typed endpoints.
controller.registerHandler(GET, "/{index}/{type}/_msearch", this);
controller.registerHandler(POST, "/{index}/{type}/_msearch", this);

this.allowExplicitIndex = MULTI_ALLOW_EXPLICIT_INDEX.get(settings);
}

Expand All @@ -88,14 +78,6 @@ public String getName() {
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
MultiSearchRequest multiSearchRequest = parseRequest(request, allowExplicitIndex);

// Emit a single deprecation message if any search request contains types.
for (SearchRequest searchRequest : multiSearchRequest.requests()) {
if (searchRequest.types().length > 0) {
deprecationLogger.deprecatedAndMaybeLog("msearch_with_types", TYPES_DEPRECATION_MESSAGE);
break;
}
}
return channel -> client.multiSearch(multiSearchRequest, new RestToXContentListener<>(channel));
}

Expand Down Expand Up @@ -145,15 +127,14 @@ public static void parseMultiLineRequest(RestRequest request, IndicesOptions ind
CheckedBiConsumer<SearchRequest, XContentParser, IOException> consumer) throws IOException {

String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
String[] types = Strings.splitStringByCommaToArray(request.param("type"));
String searchType = request.param("search_type");
boolean ccsMinimizeRoundtrips = request.paramAsBoolean("ccs_minimize_roundtrips", true);
String routing = request.param("routing");

final Tuple<XContentType, BytesReference> sourceTuple = request.contentOrSourceParam();
final XContent xContent = sourceTuple.v1().xContent();
final BytesReference data = sourceTuple.v2();
MultiSearchRequest.readMultiLineFormat(data, xContent, consumer, indices, indicesOptions, types, routing,
MultiSearchRequest.readMultiLineFormat(data, xContent, consumer, indices, indicesOptions, Strings.EMPTY_ARRAY, routing,
searchType, ccsMinimizeRoundtrips, request.getXContentRegistry(), allowExplicitIndex);
}

Expand Down

This file was deleted.

Loading