Skip to content

Commit 9b5eaaf

Browse files
lipsillnik9000
authored andcommitted
HLRC: Documentation examples cleanup (#34009)
* 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)
1 parent 3e06712 commit 9b5eaaf

File tree

7 files changed

+18
-24
lines changed

7 files changed

+18
-24
lines changed

client/rest-high-level/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ integTestRunner {
8585
}
8686

8787
integTestCluster {
88+
systemProperty 'es.scripting.update.ctx_in_params', 'false'
8889
setting 'xpack.license.self_generated.type', 'trial'
8990
setting 'xpack.security.enabled', 'true'
9091
// Truststore settings are not used since TLS is not enabled. Included for testing the get certificates API

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/CRUDDocumentationIT.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ public void testUpdate() throws Exception {
280280
.startObject()
281281
.startObject("script")
282282
.field("lang", "painless")
283-
.field("code", "ctx._source.field += params.count")
283+
.field("source", "ctx._source.field += params.count")
284284
.endObject()
285285
.endObject()));
286286
Response response = client().performRequest(request);
@@ -991,10 +991,9 @@ public void testUpdateByQuery() throws Exception {
991991
// tag::update-by-query-request-conflicts
992992
request.setConflicts("proceed"); // <1>
993993
// end::update-by-query-request-conflicts
994-
// tag::update-by-query-request-typeOrQuery
995-
request.setDocTypes("doc"); // <1>
996-
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <2>
997-
// end::update-by-query-request-typeOrQuery
994+
// tag::update-by-query-request-query
995+
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1>
996+
// end::update-by-query-request-query
998997
// tag::update-by-query-request-size
999998
request.setSize(10); // <1>
1000999
// end::update-by-query-request-size
@@ -1110,10 +1109,9 @@ public void testDeleteByQuery() throws Exception {
11101109
// tag::delete-by-query-request-conflicts
11111110
request.setConflicts("proceed"); // <1>
11121111
// end::delete-by-query-request-conflicts
1113-
// tag::delete-by-query-request-typeOrQuery
1114-
request.setDocTypes("doc"); // <1>
1115-
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <2>
1116-
// end::delete-by-query-request-typeOrQuery
1112+
// tag::delete-by-query-request-query
1113+
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1>
1114+
// end::delete-by-query-request-query
11171115
// tag::delete-by-query-request-size
11181116
request.setSize(10); // <1>
11191117
// end::delete-by-query-request-size

client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/SearchDocumentationIT.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,9 @@ public void testSearch() throws Exception {
140140
// end::search-request-basic
141141
}
142142
{
143-
// tag::search-request-indices-types
143+
// tag::search-request-indices
144144
SearchRequest searchRequest = new SearchRequest("posts"); // <1>
145-
searchRequest.types("doc"); // <2>
146-
// end::search-request-indices-types
145+
// end::search-request-indices
147146
// tag::search-request-routing
148147
searchRequest.routing("routing"); // <1>
149148
// end::search-request-routing

docs/java-rest/high-level/document/delete-by-query.asciidoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ include-tagged::{doc-tests}/CRUDDocumentationIT.java[delete-by-query-request-con
2424
--------------------------------------------------
2525
<1> Set `proceed` on version conflict
2626

27-
You can limit the documents by adding a type to the source or by adding a query.
27+
You can limit the documents by adding a query.
2828

2929
["source","java",subs="attributes,callouts,macros"]
3030
--------------------------------------------------
31-
include-tagged::{doc-tests}/CRUDDocumentationIT.java[delete-by-query-request-typeOrQuery]
31+
include-tagged::{doc-tests}/CRUDDocumentationIT.java[delete-by-query-request-query]
3232
--------------------------------------------------
33-
<1> Only copy `doc` type
34-
<2> Only copy documents which have field `user` set to `kimchy`
33+
<1> Only copy documents which have field `user` set to `kimchy`
3534

3635
It’s also possible to limit the number of processed documents by setting size.
3736

docs/java-rest/high-level/document/update-by-query.asciidoc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ include-tagged::{doc-tests}/CRUDDocumentationIT.java[update-by-query-request-con
2525
--------------------------------------------------
2626
<1> Set `proceed` on version conflict
2727

28-
You can limit the documents by adding a type to the source or by adding a query.
28+
You can limit the documents by adding a query.
2929

3030
["source","java",subs="attributes,callouts,macros"]
3131
--------------------------------------------------
32-
include-tagged::{doc-tests}/CRUDDocumentationIT.java[update-by-query-request-typeOrQuery]
32+
include-tagged::{doc-tests}/CRUDDocumentationIT.java[update-by-query-request-query]
3333
--------------------------------------------------
34-
<1> Only copy `doc` type
35-
<2> Only copy documents which have field `user` set to `kimchy`
34+
<1> Only copy documents which have field `user` set to `kimchy`
3635

3736
It’s also possible to limit the number of processed documents by setting size.
3837

docs/java-rest/high-level/search/multi-search.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@ For example:
2828

2929
["source","java",subs="attributes,callouts,macros"]
3030
--------------------------------------------------
31-
include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-indices-types]
31+
include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-indices]
3232
--------------------------------------------------
3333
<1> Restricts the request to an index
34-
<2> Limits the request to a type
3534

3635
[[java-rest-high-multi-search-sync]]
3736
==== Synchronous Execution

docs/java-rest/high-level/search/search.asciidoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ Let's first look at some of the optional arguments of a +{request}+:
3333

3434
["source","java",subs="attributes,callouts,macros"]
3535
--------------------------------------------------
36-
include-tagged::{doc-tests-file}[{api}-request-indices-types]
36+
include-tagged::{doc-tests-file}[{api}-request-indices]
3737
--------------------------------------------------
3838
<1> Restricts the request to an index
39-
<2> Limits the request to a type
4039

4140
There are a couple of other interesting optional parameters:
4241

0 commit comments

Comments
 (0)