From 8e2c431cff19b3a70a6883217ea3aa521ed91b09 Mon Sep 17 00:00:00 2001 From: lipsill Date: Mon, 24 Sep 2018 13:50:26 +0200 Subject: [PATCH 1/4] Replace deprecated field `code` with `source` for stored scripts (#25127) --- .../elasticsearch/client/documentation/CRUDDocumentationIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java index 85612147b464d..dbbd2c36401dd 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java @@ -290,7 +290,7 @@ public void testUpdate() throws Exception { .startObject() .startObject("script") .field("lang", "painless") - .field("code", "ctx._source.field += params.count") + .field("source", "ctx._source.field += params.count") .endObject() .endObject())); Response response = client().performRequest(request); From 1e9adfcd210e384204d42bd6aaebedac1086ce97 Mon Sep 17 00:00:00 2001 From: lipsill Date: Mon, 24 Sep 2018 14:52:26 +0200 Subject: [PATCH 2/4] Replace examples using the deprecated endpoint `{index}/{type}/_search` with `{index}/_search` (#29468) --- .../client/documentation/CRUDDocumentationIT.java | 14 ++++++-------- .../documentation/SearchDocumentationIT.java | 5 ++--- .../high-level/document/delete-by-query.asciidoc | 7 +++---- .../high-level/document/update-by-query.asciidoc | 7 +++---- .../high-level/search/multi-search.asciidoc | 3 +-- docs/java-rest/high-level/search/search.asciidoc | 3 +-- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java index dbbd2c36401dd..c5e7dd8db92f9 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java @@ -975,10 +975,9 @@ public void testUpdateByQuery() throws Exception { // tag::update-by-query-request-conflicts request.setConflicts("proceed"); // <1> // end::update-by-query-request-conflicts - // tag::update-by-query-request-typeOrQuery - request.setDocTypes("doc"); // <1> - request.setQuery(new TermQueryBuilder("user", "kimchy")); // <2> - // end::update-by-query-request-typeOrQuery + // tag::update-by-query-request-query + request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1> + // end::update-by-query-request-query // tag::update-by-query-request-size request.setSize(10); // <1> // end::update-by-query-request-size @@ -1093,10 +1092,9 @@ public void testDeleteByQuery() throws Exception { // tag::delete-by-query-request-conflicts request.setConflicts("proceed"); // <1> // end::delete-by-query-request-conflicts - // tag::delete-by-query-request-typeOrQuery - request.setDocTypes("doc"); // <1> - request.setQuery(new TermQueryBuilder("user", "kimchy")); // <2> - // end::delete-by-query-request-typeOrQuery + // tag::delete-by-query-request-query + request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1> + // end::delete-by-query-request-query // tag::delete-by-query-request-size request.setSize(10); // <1> // end::delete-by-query-request-size diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java index d9d4f665f9d7c..04a9c068512a2 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java @@ -140,10 +140,9 @@ public void testSearch() throws Exception { // end::search-request-basic } { - // tag::search-request-indices-types + // tag::search-request-indices SearchRequest searchRequest = new SearchRequest("posts"); // <1> - searchRequest.types("doc"); // <2> - // end::search-request-indices-types + // end::search-request-indices // tag::search-request-routing searchRequest.routing("routing"); // <1> // end::search-request-routing diff --git a/docs/java-rest/high-level/document/delete-by-query.asciidoc b/docs/java-rest/high-level/document/delete-by-query.asciidoc index 5ec246a9121ec..3a4c8a15deae6 100644 --- a/docs/java-rest/high-level/document/delete-by-query.asciidoc +++ b/docs/java-rest/high-level/document/delete-by-query.asciidoc @@ -24,14 +24,13 @@ include-tagged::{doc-tests}/CRUDDocumentationIT.java[delete-by-query-request-con -------------------------------------------------- <1> Set `proceed` on version conflict -You can limit the documents by adding a type to the source or by adding a query. +You can limit the documents by adding a query. ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/CRUDDocumentationIT.java[delete-by-query-request-typeOrQuery] +include-tagged::{doc-tests}/CRUDDocumentationIT.java[delete-by-query-request-query] -------------------------------------------------- -<1> Only copy `doc` type -<2> Only copy documents which have field `user` set to `kimchy` +<1> Only copy documents which have field `user` set to `kimchy` It’s also possible to limit the number of processed documents by setting size. diff --git a/docs/java-rest/high-level/document/update-by-query.asciidoc b/docs/java-rest/high-level/document/update-by-query.asciidoc index 324385a442b5d..5c7e4f5d3b072 100644 --- a/docs/java-rest/high-level/document/update-by-query.asciidoc +++ b/docs/java-rest/high-level/document/update-by-query.asciidoc @@ -25,14 +25,13 @@ include-tagged::{doc-tests}/CRUDDocumentationIT.java[update-by-query-request-con -------------------------------------------------- <1> Set `proceed` on version conflict -You can limit the documents by adding a type to the source or by adding a query. +You can limit the documents by adding a query. ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/CRUDDocumentationIT.java[update-by-query-request-typeOrQuery] +include-tagged::{doc-tests}/CRUDDocumentationIT.java[update-by-query-request-query] -------------------------------------------------- -<1> Only copy `doc` type -<2> Only copy documents which have field `user` set to `kimchy` +<1> Only copy documents which have field `user` set to `kimchy` It’s also possible to limit the number of processed documents by setting size. diff --git a/docs/java-rest/high-level/search/multi-search.asciidoc b/docs/java-rest/high-level/search/multi-search.asciidoc index 5d5910be30084..279b1c7fa39ad 100644 --- a/docs/java-rest/high-level/search/multi-search.asciidoc +++ b/docs/java-rest/high-level/search/multi-search.asciidoc @@ -28,10 +28,9 @@ For example: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-indices-types] +include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-indices] -------------------------------------------------- <1> Restricts the request to an index -<2> Limits the request to a type [[java-rest-high-multi-search-sync]] ==== Synchronous Execution diff --git a/docs/java-rest/high-level/search/search.asciidoc b/docs/java-rest/high-level/search/search.asciidoc index 3e9472ff2cb58..4f961214f2c63 100644 --- a/docs/java-rest/high-level/search/search.asciidoc +++ b/docs/java-rest/high-level/search/search.asciidoc @@ -27,10 +27,9 @@ Let's first look at some of the optional arguments of a `SearchRequest`: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- -include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-indices-types] +include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-indices] -------------------------------------------------- <1> Restricts the request to an index -<2> Limits the request to a type There are a couple of other interesting optional parameters: From 44b354a6c2b99407a0f10d93174f74282deb3876 Mon Sep 17 00:00:00 2001 From: lipsill Date: Mon, 24 Sep 2018 15:03:10 +0200 Subject: [PATCH 3/4] Use a system property to avoid deprecation warnings after the Update Scripts have been moved to their own context (#32096) --- client/rest-high-level/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/client/rest-high-level/build.gradle b/client/rest-high-level/build.gradle index c608d7c91f16e..ef196a07de52b 100644 --- a/client/rest-high-level/build.gradle +++ b/client/rest-high-level/build.gradle @@ -83,6 +83,7 @@ integTestRunner { } integTestCluster { + systemProperty 'es.scripting.update.ctx_in_params', 'false' setting 'xpack.license.self_generated.type', 'trial' setting 'xpack.security.enabled', 'true' setupCommand 'setupDummyUser', From a144aaac9e04c2c0ccdb5e831e84c1f076c77da5 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Tue, 16 Oct 2018 10:28:35 -0400 Subject: [PATCH 4/4] Ooops --- docs/java-rest/high-level/search/search.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/java-rest/high-level/search/search.asciidoc b/docs/java-rest/high-level/search/search.asciidoc index 0ba10cd6257e6..81e680b92506b 100644 --- a/docs/java-rest/high-level/search/search.asciidoc +++ b/docs/java-rest/high-level/search/search.asciidoc @@ -34,6 +34,7 @@ Let's first look at some of the optional arguments of a +{request}+: ["source","java",subs="attributes,callouts,macros"] -------------------------------------------------- include-tagged::{doc-tests-file}[{api}-request-indices] +-------------------------------------------------- <1> Restricts the request to an index There are a couple of other interesting optional parameters: