Deprecate types in update_by_query and delete_by_query (#36365)

Relates to #35190
This commit is contained in:
Mayya Sharipova 2018-12-11 17:09:59 -05:00 committed by GitHub
parent 8e988f6c06
commit 2f18325384
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 251 additions and 181 deletions

View File

@ -88,7 +88,7 @@ This API doesn't allow you to move the documents it touches, just modify their
source. This is intentional! We've made no provisions for removing the document
from its original location.
You can also perform these operations on multiple indices and types at once, similar to the search API:
You can also perform these operations on multiple indices at once, similar to the search API:
["source","java",subs="attributes,callouts,macros"]
--------------------------------------------------

View File

@ -172,7 +172,7 @@ public class ReindexDocumentationIT extends ESIntegTestCase {
// tag::update-by-query-multi-index
UpdateByQueryRequestBuilder updateByQuery =
new UpdateByQueryRequestBuilder(client, UpdateByQueryAction.INSTANCE);
updateByQuery.source("foo", "bar").source().setTypes("a", "b");
updateByQuery.source("foo", "bar");
BulkByScrollResponse response = updateByQuery.get();
// end::update-by-query-multi-index
}

View File

@ -21,20 +21,43 @@ package org.elasticsearch.index.reindex;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.search.RestSearchAction;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.junit.Before;
import java.io.IOException;
import static java.util.Collections.emptyList;
import static org.mockito.Mockito.mock;
public class RestDeleteByQueryActionTests extends ESTestCase {
public class RestDeleteByQueryActionTests extends RestActionTestCase {
private RestDeleteByQueryAction action;
@Before
public void setUpAction() {
action = new RestDeleteByQueryAction(Settings.EMPTY, controller());
}
public void testTypeInPath() throws IOException {
RestRequest request = new FakeRestRequest.Builder(xContentRegistry())
.withMethod(RestRequest.Method.POST)
.withPath("/some_index/some_type/_delete_by_query")
.build();
dispatchRequest(request);
// checks the type in the URL is propagated correctly to the request object
// only works after the request is dispatched, so its params are filled from url.
DeleteByQueryRequest dbqRequest = action.buildRequest(request);
assertArrayEquals(new String[]{"some_type"}, dbqRequest.getDocTypes());
// RestDeleteByQueryAction itself doesn't check for a deprecated type usage
// checking here for a deprecation from its internal search request
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
public void testParseEmpty() throws IOException {
RestDeleteByQueryAction action = new RestDeleteByQueryAction(Settings.EMPTY, mock(RestController.class));
DeleteByQueryRequest request = action.buildRequest(new FakeRestRequest.Builder(new NamedXContentRegistry(emptyList()))
.build());
DeleteByQueryRequest request = action.buildRequest(new FakeRestRequest.Builder(new NamedXContentRegistry(emptyList())).build());
assertEquals(AbstractBulkByScrollRequest.SIZE_ALL_MATCHES, request.getSize());
assertEquals(AbstractBulkByScrollRequest.DEFAULT_SCROLL_SIZE, request.getSearchRequest().source().size());
}

View File

@ -21,20 +21,44 @@ package org.elasticsearch.index.reindex;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.search.RestSearchAction;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.junit.Before;
import java.io.IOException;
import static java.util.Collections.emptyList;
import static org.mockito.Mockito.mock;
public class RestUpdateByQueryActionTests extends ESTestCase {
public class RestUpdateByQueryActionTests extends RestActionTestCase {
private RestUpdateByQueryAction action;
@Before
public void setUpAction() {
action = new RestUpdateByQueryAction(Settings.EMPTY, controller());
}
public void testTypeInPath() throws IOException {
RestRequest request = new FakeRestRequest.Builder(xContentRegistry())
.withMethod(RestRequest.Method.POST)
.withPath("/some_index/some_type/_update_by_query")
.build();
dispatchRequest(request);
// checks the type in the URL is propagated correctly to the request object
// only works after the request is dispatched, so its params are filled from url.
UpdateByQueryRequest ubqRequest = action.buildRequest(request);
assertArrayEquals(new String[]{"some_type"}, ubqRequest.getDocTypes());
// RestUpdateByQueryAction itself doesn't check for a deprecated type usage
// checking here for a deprecation from its internal search request
assertWarnings(RestSearchAction.TYPES_DEPRECATION_MESSAGE);
}
public void testParseEmpty() throws IOException {
RestUpdateByQueryAction action = new RestUpdateByQueryAction(Settings.EMPTY, mock(RestController.class));
UpdateByQueryRequest request = action.buildRequest(new FakeRestRequest.Builder(new NamedXContentRegistry(emptyList()))
.build());
UpdateByQueryRequest request = action.buildRequest(new FakeRestRequest.Builder(new NamedXContentRegistry(emptyList())).build());
assertEquals(AbstractBulkByScrollRequest.SIZE_ALL_MATCHES, request.getSize());
assertEquals(AbstractBulkByScrollRequest.DEFAULT_SCROLL_SIZE, request.getSearchRequest().source().size());
}

View File

@ -3,7 +3,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -42,7 +42,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -99,7 +99,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -108,7 +108,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test2" }
@ -124,12 +124,12 @@
- match: {version_conflicts: 1}
- match: {batches: 1}
- match: {failures.0.index: test}
- match: {failures.0.type: foo}
- match: {failures.0.type: _doc}
- match: {failures.0.id: "1"}
- match: {failures.0.status: 409}
- match: {failures.0.cause.type: version_conflict_engine_exception}
# Use a regex so we don't mind if the current version isn't always 1. Sometimes it comes out 2.
- match: {failures.0.cause.reason: "/\\[foo\\]\\[1\\]:.version.conflict,.current.version.\\[\\d+\\].is.different.than.the.one.provided.\\[\\d+\\]/"}
- match: {failures.0.cause.reason: "/\\[_doc\\]\\[1\\]:.version.conflict,.current.version.\\[\\d+\\].is.different.than.the.one.provided.\\[\\d+\\]/"}
- match: {failures.0.cause.shard: /\d+/}
- match: {failures.0.cause.index: test}
- gte: { took: 0 }
@ -154,7 +154,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -163,7 +163,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test2" }
@ -197,13 +197,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "junk" }
- do:
@ -234,13 +234,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "kimchy" }
- do:
@ -281,17 +281,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}

View File

@ -19,7 +19,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -36,7 +36,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -53,7 +53,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { "text": "test" }
- do:

View File

@ -3,7 +3,7 @@
- do:
index:
index: index1
type: type1
type: _doc
id: 1
version: 0 # Starting version is zero
version_type: external
@ -24,6 +24,6 @@
- do:
get:
index: index1
type: type1
type: _doc
id: 1
- match: {_version: 0}

View File

@ -9,7 +9,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: {"text": "test"}
- do:

View File

@ -10,17 +10,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -50,17 +50,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -91,17 +91,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -151,17 +151,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}

View File

@ -3,25 +3,25 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:
@ -69,25 +69,25 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:
@ -176,37 +176,37 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 5
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 6
body: { "text": "test" }
- do:
@ -297,25 +297,25 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:

View File

@ -3,7 +3,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -30,7 +30,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -84,7 +84,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -93,7 +93,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test2" }
@ -105,12 +105,12 @@
- match: {version_conflicts: 1}
- match: {batches: 1}
- match: {failures.0.index: test}
- match: {failures.0.type: foo}
- match: {failures.0.type: _doc}
- match: {failures.0.id: "1"}
- match: {failures.0.status: 409}
- match: {failures.0.cause.type: version_conflict_engine_exception}
# Use a regex so we don't mind if the current version isn't always 1. Sometimes it comes out 2.
- match: {failures.0.cause.reason: "/\\[foo\\]\\[1\\]:.version.conflict,.current.version.\\[\\d+\\].is.different.than.the.one.provided.\\[\\d+\\]/"}
- match: {failures.0.cause.reason: "/\\[_doc\\]\\[1\\]:.version.conflict,.current.version.\\[\\d+\\].is.different.than.the.one.provided.\\[\\d+\\]/"}
- match: {failures.0.cause.shard: /\d+/}
- match: {failures.0.cause.index: test}
- gte: { took: 0 }
@ -126,7 +126,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -135,7 +135,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test2" }
@ -156,13 +156,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "junk" }
- do:
@ -186,13 +186,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "kimchy" }
- do:
@ -220,17 +220,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -246,7 +246,7 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: {}
- do:
@ -260,7 +260,7 @@
- do:
get:
index: test
type: foo
type: _doc
id: 1
- match: { _source: {} }
- match: { _version: 2 }

View File

@ -3,7 +3,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -17,7 +17,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -31,7 +31,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -47,20 +47,20 @@
index: test
body:
mappings:
test:
_doc:
_source:
enabled: false
- do:
index:
index: test
type: test
type: _doc
id: 1
body: { age: 23 }
- do:
indices.refresh: {}
- do:
catch: /\[test\]\[test\]\[1\] didn't store _source/
catch: /\[test\]\[_doc\]\[1\] didn't store _source/
update_by_query:
index: test

View File

@ -12,7 +12,7 @@
- do:
index:
index: test
type: place
type: _doc
id: 1
refresh: true
body: { "name": "bob! house" }
@ -20,7 +20,7 @@
- do:
indices.put_mapping:
index: test
type: place
type: _doc
body:
properties:
name:

View File

@ -10,7 +10,7 @@
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:

View File

@ -3,7 +3,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: {"text": "test"}
- do:
@ -18,7 +18,7 @@
- do:
get:
index: test
type: test
type: _doc
id: 1
- match: {_version: 2}
@ -27,7 +27,7 @@
- do:
index:
index: index1
type: type1
type: _doc
id: 1
version: 0 # Starting version is zero
version_type: external
@ -45,6 +45,6 @@
- do:
get:
index: index1
type: type1
type: _doc
id: 1
- match: {_version: 0}

View File

@ -9,7 +9,7 @@
- do:
index:
index: test
type: test
type: _doc
id: 1
body: {"text": "test"}
- do:
@ -35,5 +35,5 @@
- do:
get:
index: test
type: test
type: _doc
id: 1

View File

@ -10,17 +10,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -46,17 +46,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -83,17 +83,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}
@ -130,17 +130,17 @@
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
body: { "text": "test" }
- do:
indices.refresh: {}

View File

@ -3,25 +3,25 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:
@ -61,25 +61,25 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:
@ -163,37 +163,37 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 5
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 6
body: { "text": "test" }
- do:
@ -280,25 +280,25 @@
- do:
index:
index: test
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 2
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 3
body: { "text": "test" }
- do:
index:
index: test
type: foo
type: _doc
id: 4
body: { "text": "test" }
- do:

View File

@ -3,7 +3,7 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
@ -35,7 +35,7 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
@ -64,13 +64,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "foo" }
- do:
@ -112,13 +112,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "foo" }
- do:
@ -141,7 +141,7 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
@ -161,7 +161,7 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
@ -181,25 +181,25 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "level": 9, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "level": 10, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 3
body: { "level": 11, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 4
body: { "level": 12, "last_updated": "2016-01-01T12:10:30Z" }
- do:
@ -247,25 +247,25 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "level": 9, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "level": 10, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 3
body: { "level": 11, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 4
body: { "level": 12, "last_updated": "2016-01-01T12:10:30Z" }
- do:
@ -326,13 +326,13 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "user": "foo" }
- do:
@ -355,25 +355,25 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "level": 9, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 2
body: { "level": 10, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 3
body: { "level": 11, "last_updated": "2016-01-01T12:10:30Z" }
- do:
index:
index: twitter
type: tweet
type: _doc
id: 4
body: { "level": 12, "last_updated": "2016-01-01T12:10:30Z" }
- do:
@ -439,7 +439,7 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:

View File

@ -18,7 +18,7 @@
- do:
index:
index: twitter
type: tweet
type: _doc
id: 1
body: { "user": "kimchy" }
- do:

View File

@ -89,7 +89,10 @@ public class DeleteByQueryRequest extends AbstractBulkByScrollRequest<DeleteByQu
/**
* Set the document types for the delete
* @deprecated Types are in the process of being removed. Instead of
* using a type, prefer to filter on a field of the document.
*/
@Deprecated
public DeleteByQueryRequest setDocTypes(String... types) {
if (types != null) {
getSearchRequest().types(types);
@ -140,7 +143,10 @@ public class DeleteByQueryRequest extends AbstractBulkByScrollRequest<DeleteByQu
/**
* Gets the document types on which this request would be executed. Returns an empty array if all
* types are to be processed.
* @deprecated Types are in the process of being removed. Instead of
* using a type, prefer to filter on a field of the document.
*/
@Deprecated
public String[] getDocTypes() {
if (getSearchRequest().types() != null) {
return getSearchRequest().types();
@ -202,11 +208,23 @@ public class DeleteByQueryRequest extends AbstractBulkByScrollRequest<DeleteByQu
return getSearchRequest().indicesOptions();
}
/**
* Gets the document types on which this request would be executed.
* @deprecated Types are in the process of being removed. Instead of
* using a type, prefer to filter on a field of the document.
*/
@Deprecated
public String[] types() {
assert getSearchRequest() != null;
return getSearchRequest().types();
}
/**
* Set the document types for the delete
* @deprecated Types are in the process of being removed. Instead of
* using a type, prefer to filter on a field of the document.
*/
@Deprecated
public DeleteByQueryRequest types(String... types) {
assert getSearchRequest() != null;
getSearchRequest().types(types);

View File

@ -85,7 +85,10 @@ public class UpdateByQueryRequest extends AbstractBulkIndexByScrollRequest<Updat
/**
* Set the document types for the update
* @deprecated Types are in the process of being removed. Instead of
* using a type, prefer to filter on a field of the document.
*/
@Deprecated
public UpdateByQueryRequest setDocTypes(String... types) {
if (types != null) {
getSearchRequest().types(types);
@ -136,7 +139,10 @@ public class UpdateByQueryRequest extends AbstractBulkIndexByScrollRequest<Updat
/**
* Gets the document types on which this request would be executed. Returns an empty array if all
* types are to be processed.
* @deprecated Types are in the process of being removed. Instead of
* using a type, prefer to filter on a field of the document.
*/
@Deprecated
public String[] getDocTypes() {
if (getSearchRequest().types() != null) {
return getSearchRequest().types();

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.document;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestRequest.Method;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.junit.Before;

View File

@ -21,8 +21,8 @@ package org.elasticsearch.rest.action.document;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestRequest.Method;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.junit.Before;
public class RestGetActionTests extends RestActionTestCase {

View File

@ -26,8 +26,8 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestRequest.Method;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.junit.Before;
public class RestMultiGetActionTests extends RestActionTestCase {

View File

@ -26,7 +26,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestRequest.Method;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.junit.Before;

View File

@ -26,7 +26,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestRequest.Method;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.junit.Before;

View File

@ -22,7 +22,7 @@ package org.elasticsearch.rest.action.search;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestRequest.Method;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.junit.Before;

View File

@ -21,8 +21,8 @@ package org.elasticsearch.rest.action.search;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.junit.Before;
public class RestExplainActionTests extends RestActionTestCase {

View File

@ -23,7 +23,7 @@ import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.junit.Before;

View File

@ -21,7 +21,7 @@ package org.elasticsearch.rest.action.search;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.RestActionTestCase;
import org.elasticsearch.test.rest.RestActionTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
import org.junit.Before;

View File

@ -17,7 +17,7 @@
* under the License.
*/
package org.elasticsearch.rest.action;
package org.elasticsearch.test.rest;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.common.settings.Settings;
@ -26,7 +26,6 @@ import org.elasticsearch.indices.breaker.NoneCircuitBreakerService;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.rest.FakeRestChannel;
import org.elasticsearch.usage.UsageService;
import org.junit.Before;

View File

@ -7,7 +7,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -38,7 +38,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -70,7 +70,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -102,7 +102,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -120,7 +120,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -138,13 +138,13 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
index:
index: source
type: foo
type: _doc
id: 2
body: { "text": "test", "hidden": true }
- do:
@ -192,7 +192,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test", "foo": "z", "bar": "z" }
- do:
@ -210,7 +210,7 @@ setup:
- do:
get:
index: source
type: foo
type: _doc
id: 1
# These were visible to the user running the update_by_query so they stayed.
- match: { _source.foo: z }

View File

@ -7,7 +7,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -33,7 +33,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -60,7 +60,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -87,7 +87,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -114,7 +114,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test" }
- do:
@ -141,13 +141,13 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test", "hidden": false }
- do:
index:
index: source
type: foo
type: _doc
id: 2
body: { "text": "test", "hidden": true }
- do:
@ -211,7 +211,7 @@ setup:
- do:
index:
index: source
type: foo
type: _doc
id: 1
body: { "text": "test", "foo": "z", "bar": "z" }
- do: