From 2f18325384c77fc10f86847bcbaf268626839ce7 Mon Sep 17 00:00:00 2001 From: Mayya Sharipova Date: Tue, 11 Dec 2018 17:09:59 -0500 Subject: [PATCH] Deprecate types in update_by_query and delete_by_query (#36365) Relates to #35190 --- docs/java-api/docs/update-by-query.asciidoc | 2 +- .../documentation/ReindexDocumentationIT.java | 2 +- .../reindex/RestDeleteByQueryActionTests.java | 37 ++++++++++++--- .../reindex/RestUpdateByQueryActionTests.java | 38 ++++++++++++--- .../test/delete_by_query/10_basic.yml | 30 ++++++------ .../test/delete_by_query/20_validation.yml | 6 +-- .../test/delete_by_query/40_versioning.yml | 4 +- .../50_wait_for_active_shards.yml | 2 +- .../test/delete_by_query/70_throttle.yml | 24 +++++----- .../test/delete_by_query/80_slices.yml | 36 +++++++-------- .../test/update_by_query/10_basic.yml | 34 +++++++------- .../test/update_by_query/20_validation.yml | 12 ++--- .../test/update_by_query/30_new_fields.yml | 4 +- .../update_by_query/35_search_failure.yml | 2 +- .../test/update_by_query/40_versioning.yml | 8 ++-- .../test/update_by_query/50_consistency.yml | 4 +- .../test/update_by_query/60_throttle.yml | 24 +++++----- .../test/update_by_query/70_slices.yml | 36 +++++++-------- .../test/update_by_query/80_scripting.yml | 46 +++++++++---------- .../ingest/30_update_by_query_with_ingest.yml | 2 +- .../index/reindex/DeleteByQueryRequest.java | 18 ++++++++ .../index/reindex/UpdateByQueryRequest.java | 6 +++ .../document/RestDeleteActionTests.java | 2 +- .../action/document/RestGetActionTests.java | 2 +- .../document/RestMultiGetActionTests.java | 2 +- .../RestMultiTermVectorsActionTests.java | 2 +- .../document/RestTermVectorsActionTests.java | 2 +- .../action/search/RestCountActionTests.java | 2 +- .../action/search/RestExplainActionTests.java | 2 +- .../search/RestMultiSearchActionTests.java | 2 +- .../action/search/RestSearchActionTests.java | 2 +- .../test/rest}/RestActionTestCase.java | 3 +- .../rest-api-spec/test/20_update_by_query.yml | 18 ++++---- .../rest-api-spec/test/30_delete_by_query.yml | 16 +++---- 34 files changed, 251 insertions(+), 181 deletions(-) rename {server/src/test/java/org/elasticsearch/rest/action => test/framework/src/main/java/org/elasticsearch/test/rest}/RestActionTestCase.java (96%) diff --git a/docs/java-api/docs/update-by-query.asciidoc b/docs/java-api/docs/update-by-query.asciidoc index ae4f8d72ee1..d4fe7c1c041 100644 --- a/docs/java-api/docs/update-by-query.asciidoc +++ b/docs/java-api/docs/update-by-query.asciidoc @@ -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"] -------------------------------------------------- diff --git a/modules/reindex/src/test/java/org/elasticsearch/client/documentation/ReindexDocumentationIT.java b/modules/reindex/src/test/java/org/elasticsearch/client/documentation/ReindexDocumentationIT.java index 4ba814e4238..8def6dbb403 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/client/documentation/ReindexDocumentationIT.java +++ b/modules/reindex/src/test/java/org/elasticsearch/client/documentation/ReindexDocumentationIT.java @@ -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 } diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestDeleteByQueryActionTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestDeleteByQueryActionTests.java index 1f972cd2824..788fad32100 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestDeleteByQueryActionTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestDeleteByQueryActionTests.java @@ -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()); } diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestUpdateByQueryActionTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestUpdateByQueryActionTests.java index efb6e20a200..b5333226bb9 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestUpdateByQueryActionTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/RestUpdateByQueryActionTests.java @@ -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()); } diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/10_basic.yml b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/10_basic.yml index e5bf6368eab..9f9a99f0f5c 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/10_basic.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/10_basic.yml @@ -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: {} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/20_validation.yml b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/20_validation.yml index 89ab990bf9b..7be77132b59 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/20_validation.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/20_validation.yml @@ -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: diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/40_versioning.yml b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/40_versioning.yml index c81305e2824..1e2afacca14 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/40_versioning.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/40_versioning.yml @@ -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} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/50_wait_for_active_shards.yml b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/50_wait_for_active_shards.yml index ab21e6802f9..9e7d9c4298a 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/50_wait_for_active_shards.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/50_wait_for_active_shards.yml @@ -9,7 +9,7 @@ - do: index: index: test - type: test + type: _doc id: 1 body: {"text": "test"} - do: diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/70_throttle.yml b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/70_throttle.yml index fc6081a3de8..d02985e13bc 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/70_throttle.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/70_throttle.yml @@ -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: {} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/80_slices.yml b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/80_slices.yml index 2f40d6bfd3e..d92910af00c 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/80_slices.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/delete_by_query/80_slices.yml @@ -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: diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yml index 784623f714c..d3881035d92 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/10_basic.yml @@ -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 } diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yml index b7499180cda..8fdce4bd9db 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/20_validation.yml @@ -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 diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml index 201410d6822..ae6e7559e2d 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/30_new_fields.yml @@ -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: diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml index e7f3a146480..631f06a7847 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/35_search_failure.yml @@ -10,7 +10,7 @@ - do: index: index: source - type: foo + type: _doc id: 1 body: { "text": "test" } - do: diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yml index 1718714defd..7d2083f925b 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/40_versioning.yml @@ -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} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yml index 6e9c40146c5..bb6d5abf2a7 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/50_consistency.yml @@ -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 diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_throttle.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_throttle.yml index eb64bd8d382..2153508e88d 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_throttle.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/60_throttle.yml @@ -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: {} diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_slices.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_slices.yml index 709e08854b2..4474eaece97 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_slices.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/70_slices.yml @@ -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: diff --git a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml index b30f639591e..6ce30c60362 100644 --- a/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml +++ b/modules/reindex/src/test/resources/rest-api-spec/test/update_by_query/80_scripting.yml @@ -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: diff --git a/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/rest-api-spec/test/ingest/30_update_by_query_with_ingest.yml b/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/rest-api-spec/test/ingest/30_update_by_query_with_ingest.yml index a8f1a3fea66..0f187cc4390 100644 --- a/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/rest-api-spec/test/ingest/30_update_by_query_with_ingest.yml +++ b/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/rest-api-spec/test/ingest/30_update_by_query_with_ingest.yml @@ -18,7 +18,7 @@ - do: index: index: twitter - type: tweet + type: _doc id: 1 body: { "user": "kimchy" } - do: diff --git a/server/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java b/server/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java index 18307e0a568..227ddd48977 100644 --- a/server/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java +++ b/server/src/main/java/org/elasticsearch/index/reindex/DeleteByQueryRequest.java @@ -89,7 +89,10 @@ public class DeleteByQueryRequest extends AbstractBulkByScrollRequest