Skip to content

Commit

Permalink
HLRC: Documentation examples cleanup (#34009)
Browse files Browse the repository at this point in the history
* Replace deprecated field `code` with `source` for stored scripts (#25127)
* Replace examples using the deprecated endpoint `{index}/{type}/_search`
with `{index}/_search` (#29468)
* Use a system property to avoid deprecation warnings after the Update
Scripts have been moved to their own context (#32096)
  • Loading branch information
lipsill authored and nik9000 committed Oct 16, 2018
1 parent 3e06712 commit 9b5eaaf
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 24 deletions.
1 change: 1 addition & 0 deletions client/rest-high-level/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ integTestRunner {
}

integTestCluster {
systemProperty 'es.scripting.update.ctx_in_params', 'false'
setting 'xpack.license.self_generated.type', 'trial'
setting 'xpack.security.enabled', 'true'
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,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);
Expand Down Expand Up @@ -991,10 +991,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
Expand Down Expand Up @@ -1110,10 +1109,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions docs/java-rest/high-level/document/delete-by-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
7 changes: 3 additions & 4 deletions docs/java-rest/high-level/document/update-by-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
3 changes: 1 addition & 2 deletions docs/java-rest/high-level/search/multi-search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions docs/java-rest/high-level/search/search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ 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-types]
include-tagged::{doc-tests-file}[{api}-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:

Expand Down

0 comments on commit 9b5eaaf

Please sign in to comment.