Remove type end-points from search and related APIs (#2263)
Signed-off-by: Suraj Singh <surajrider@gmail.com>
This commit is contained in:
parent
897f4e7295
commit
3d5aff4b91
|
@ -68,10 +68,7 @@ public class RestSearchTemplateAction extends BaseRestHandler {
|
|||
new Route(GET, "/_search/template"),
|
||||
new Route(POST, "/_search/template"),
|
||||
new Route(GET, "/{index}/_search/template"),
|
||||
new Route(POST, "/{index}/_search/template"),
|
||||
// Deprecated typed endpoints.
|
||||
new Route(GET, "/{index}/{type}/_search/template"),
|
||||
new Route(POST, "/{index}/{type}/_search/template")
|
||||
new Route(POST, "/{index}/_search/template")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class RestDeleteByQueryAction extends AbstractBulkByQueryRestHandler<Dele
|
|||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(POST, "/{index}/_delete_by_query"), new Route(POST, "/{index}/{type}/_delete_by_query")));
|
||||
return unmodifiableList(asList(new Route(POST, "/{index}/_delete_by_query")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,7 @@ public class RestUpdateByQueryAction extends AbstractBulkByQueryRestHandler<Upda
|
|||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
return unmodifiableList(asList(new Route(POST, "/{index}/_update_by_query"), new Route(POST, "/{index}/{type}/_update_by_query")));
|
||||
return unmodifiableList(asList(new Route(POST, "/{index}/_update_by_query")));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The OpenSearch Contributors require contributions made to
|
||||
* this file be licensed under the Apache-2.0 license or a
|
||||
* compatible open source license.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.index.reindex;
|
||||
|
||||
import org.opensearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.opensearch.test.rest.FakeRestRequest;
|
||||
import org.opensearch.test.rest.RestActionTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class RestDeleteByQueryActionTests extends RestActionTestCase {
|
||||
private RestDeleteByQueryAction action;
|
||||
|
||||
@Before
|
||||
public void setUpAction() {
|
||||
action = new RestDeleteByQueryAction();
|
||||
controller().registerHandler(action);
|
||||
}
|
||||
|
||||
public void testParseEmpty() throws IOException {
|
||||
final FakeRestRequest restRequest = new FakeRestRequest.Builder(new NamedXContentRegistry(emptyList())).build();
|
||||
DeleteByQueryRequest request = action.buildRequest(restRequest, DEFAULT_NAMED_WRITABLE_REGISTRY);
|
||||
assertEquals(AbstractBulkByScrollRequest.SIZE_ALL_MATCHES, request.getSize());
|
||||
assertEquals(AbstractBulkByScrollRequest.DEFAULT_SCROLL_SIZE, request.getSearchRequest().source().size());
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* The OpenSearch Contributors require contributions made to
|
||||
* this file be licensed under the Apache-2.0 license or a
|
||||
* compatible open source license.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modifications Copyright OpenSearch Contributors. See
|
||||
* GitHub history for details.
|
||||
*/
|
||||
|
||||
package org.opensearch.index.reindex;
|
||||
|
||||
import org.opensearch.common.xcontent.NamedXContentRegistry;
|
||||
import org.opensearch.test.rest.FakeRestRequest;
|
||||
import org.opensearch.test.rest.RestActionTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class RestUpdateByQueryActionTests extends RestActionTestCase {
|
||||
|
||||
private RestUpdateByQueryAction action;
|
||||
|
||||
@Before
|
||||
public void setUpAction() {
|
||||
action = new RestUpdateByQueryAction();
|
||||
controller().registerHandler(action);
|
||||
}
|
||||
|
||||
public void testParseEmpty() throws IOException {
|
||||
final FakeRestRequest restRequest = new FakeRestRequest.Builder(new NamedXContentRegistry(emptyList())).build();
|
||||
UpdateByQueryRequest request = action.buildRequest(restRequest, DEFAULT_NAMED_WRITABLE_REGISTRY);
|
||||
assertEquals(AbstractBulkByScrollRequest.SIZE_ALL_MATCHES, request.getSize());
|
||||
assertEquals(AbstractBulkByScrollRequest.DEFAULT_SCROLL_SIZE, request.getSearchRequest().source().size());
|
||||
}
|
||||
}
|
|
@ -18,25 +18,6 @@
|
|||
"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}/_delete_by_query",
|
||||
"methods": ["POST"],
|
||||
"parts": {
|
||||
"index": {
|
||||
"required": true,
|
||||
"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": {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -15,34 +15,16 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"path":"/{index}/_msearch",
|
||||
"methods":[
|
||||
"path": "/{index}/_msearch",
|
||||
"methods": [
|
||||
"GET",
|
||||
"POST"
|
||||
],
|
||||
"parts":{
|
||||
"index":{
|
||||
"type":"list",
|
||||
"description":"A comma-separated list of index names to use as default"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "/{index}/{type}/_msearch",
|
||||
"methods": ["GET", "POST"],
|
||||
"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"
|
||||
"type": "list",
|
||||
"description": "A comma-separated list of index names to use as default"
|
||||
}
|
||||
},
|
||||
"deprecated": {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -26,24 +26,6 @@
|
|||
"description":"A comma-separated list of index names to use as default"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "/{index}/{type}/_msearch/template",
|
||||
"methods": ["GET", "POST"],
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"deprecated": {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -26,25 +26,6 @@
|
|||
"description":"The index in which the document resides."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "/{index}/{type}/_mtermvectors",
|
||||
"methods" : ["GET", "POST"],
|
||||
"parts" : {
|
||||
"index" : {
|
||||
"type" : "string",
|
||||
"description" : "The index in which the document resides."
|
||||
},
|
||||
"type" : {
|
||||
"type" : "string",
|
||||
"description" : "The type of the document."
|
||||
}
|
||||
},
|
||||
"deprecated":{
|
||||
"version" : "7.0.0",
|
||||
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -26,24 +26,6 @@
|
|||
"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}/_search",
|
||||
"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" : {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -26,24 +26,6 @@
|
|||
"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}/_search/template",
|
||||
"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" : {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -36,50 +36,6 @@
|
|||
"description":"The index in which the document resides."
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "/{index}/{type}/{id}/_termvectors",
|
||||
"methods" : ["GET", "POST"],
|
||||
"parts" : {
|
||||
"index" : {
|
||||
"type" : "string",
|
||||
"description" : "The index in which the document resides.",
|
||||
"required" : true
|
||||
},
|
||||
"type" : {
|
||||
"type" : "string",
|
||||
"description" : "The type of the document.",
|
||||
"required" : false
|
||||
},
|
||||
"id" : {
|
||||
"type" : "string",
|
||||
"description" : "The id of the document, when not specified a doc param should be supplied."
|
||||
}
|
||||
},
|
||||
"deprecated": {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "/{index}/{type}/_termvectors",
|
||||
"methods" : ["GET", "POST"],
|
||||
"parts" : {
|
||||
"index" : {
|
||||
"type" : "string",
|
||||
"description" : "The index in which the document resides.",
|
||||
"required" : true
|
||||
},
|
||||
"type" : {
|
||||
"type" : "string",
|
||||
"description" : "The type of the document.",
|
||||
"required" : false
|
||||
}
|
||||
},
|
||||
"deprecated": {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -18,25 +18,6 @@
|
|||
"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}/_update_by_query",
|
||||
"methods": ["POST"],
|
||||
"parts": {
|
||||
"index": {
|
||||
"required": true,
|
||||
"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" : {
|
||||
"version" : "7.0.0",
|
||||
"description" : "Specifying types in urls has been deprecated"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
---
|
||||
"mtermvectors without types on an index that has types":
|
||||
|
||||
- skip:
|
||||
version: " - 6.99.99"
|
||||
reason: Typeless APIs were introduced in 7.0.0
|
||||
|
||||
- do:
|
||||
indices.create: # not using include_type_name: false on purpose
|
||||
include_type_name: true
|
||||
index: index
|
||||
body:
|
||||
mappings:
|
||||
not_doc:
|
||||
properties:
|
||||
foo:
|
||||
type : "text"
|
||||
term_vector : "with_positions_offsets"
|
||||
|
||||
- do:
|
||||
index:
|
||||
index: index
|
||||
id: 1
|
||||
body: { foo: bar }
|
||||
|
||||
- do:
|
||||
mtermvectors:
|
||||
body:
|
||||
docs:
|
||||
- _index: index
|
||||
_id: 1
|
||||
|
||||
- match: {docs.0.term_vectors.foo.terms.bar.term_freq: 1}
|
|
@ -36,7 +36,6 @@ import org.opensearch.action.termvectors.MultiTermVectorsRequest;
|
|||
import org.opensearch.action.termvectors.TermVectorsRequest;
|
||||
import org.opensearch.client.node.NodeClient;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
import org.opensearch.rest.RestRequest;
|
||||
import org.opensearch.rest.action.RestToXContentListener;
|
||||
|
@ -50,8 +49,6 @@ import static org.opensearch.rest.RestRequest.Method.GET;
|
|||
import static org.opensearch.rest.RestRequest.Method.POST;
|
||||
|
||||
public class RestMultiTermVectorsAction extends BaseRestHandler {
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestTermVectorsAction.class);
|
||||
static final String TYPES_DEPRECATION_MESSAGE = "[types removal] " + "Specifying types in multi term vector requests is deprecated.";
|
||||
|
||||
@Override
|
||||
public List<Route> routes() {
|
||||
|
@ -60,10 +57,7 @@ public class RestMultiTermVectorsAction extends BaseRestHandler {
|
|||
new Route(GET, "/_mtermvectors"),
|
||||
new Route(POST, "/_mtermvectors"),
|
||||
new Route(GET, "/{index}/_mtermvectors"),
|
||||
new Route(POST, "/{index}/_mtermvectors"),
|
||||
// Deprecated typed endpoints.
|
||||
new Route(GET, "/{index}/{type}/_mtermvectors"),
|
||||
new Route(POST, "/{index}/{type}/_mtermvectors")
|
||||
new Route(POST, "/{index}/_mtermvectors")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -66,12 +66,7 @@ public class RestTermVectorsAction extends BaseRestHandler {
|
|||
new Route(GET, "/{index}/_termvectors"),
|
||||
new Route(POST, "/{index}/_termvectors"),
|
||||
new Route(GET, "/{index}/_termvectors/{id}"),
|
||||
new Route(POST, "/{index}/_termvectors/{id}"),
|
||||
// Deprecated typed endpoints.
|
||||
new Route(GET, "/{index}/{type}/_termvectors"),
|
||||
new Route(POST, "/{index}/{type}/_termvectors"),
|
||||
new Route(GET, "/{index}/{type}/{id}/_termvectors"),
|
||||
new Route(POST, "/{index}/{type}/{id}/_termvectors")
|
||||
new Route(POST, "/{index}/_termvectors/{id}")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -91,10 +91,7 @@ public class RestMultiSearchAction extends BaseRestHandler {
|
|||
new Route(GET, "/_msearch"),
|
||||
new Route(POST, "/_msearch"),
|
||||
new Route(GET, "/{index}/_msearch"),
|
||||
new Route(POST, "/{index}/_msearch"),
|
||||
// Deprecated typed endpoints.
|
||||
new Route(GET, "/{index}/{type}/_msearch"),
|
||||
new Route(POST, "/{index}/{type}/_msearch")
|
||||
new Route(POST, "/{index}/_msearch")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.opensearch.client.node.NodeClient;
|
|||
import org.opensearch.common.Booleans;
|
||||
import org.opensearch.common.Strings;
|
||||
import org.opensearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.opensearch.common.logging.DeprecationLogger;
|
||||
import org.opensearch.common.xcontent.XContentParser;
|
||||
import org.opensearch.index.query.QueryBuilder;
|
||||
import org.opensearch.rest.BaseRestHandler;
|
||||
|
@ -89,9 +88,6 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
RESPONSE_PARAMS = Collections.unmodifiableSet(responseParams);
|
||||
}
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestSearchAction.class);
|
||||
public static final String TYPES_DEPRECATION_MESSAGE = "[types removal]" + " Specifying types in search requests is deprecated.";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "search_action";
|
||||
|
@ -104,10 +100,7 @@ public class RestSearchAction extends BaseRestHandler {
|
|||
new Route(GET, "/_search"),
|
||||
new Route(POST, "/_search"),
|
||||
new Route(GET, "/{index}/_search"),
|
||||
new Route(POST, "/{index}/_search"),
|
||||
// Deprecated typed endpoints.
|
||||
new Route(GET, "/{index}/{type}/_search"),
|
||||
new Route(POST, "/{index}/{type}/_search")
|
||||
new Route(POST, "/{index}/_search")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue