Skip to content

Commit c360979

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 537f28e commit c360979

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
@@ -282,7 +282,7 @@ public void testUpdate() throws Exception {
282282
.startObject()
283283
.startObject("script")
284284
.field("lang", "painless")
285-
.field("code", "ctx._source.field += params.count")
285+
.field("source", "ctx._source.field += params.count")
286286
.endObject()
287287
.endObject()));
288288
Response response = client().performRequest(request);
@@ -994,10 +994,9 @@ public void testUpdateByQuery() throws Exception {
994994
// tag::update-by-query-request-conflicts
995995
request.setConflicts("proceed"); // <1>
996996
// end::update-by-query-request-conflicts
997-
// tag::update-by-query-request-typeOrQuery
998-
request.setDocTypes("doc"); // <1>
999-
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <2>
1000-
// end::update-by-query-request-typeOrQuery
997+
// tag::update-by-query-request-query
998+
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1>
999+
// end::update-by-query-request-query
10011000
// tag::update-by-query-request-size
10021001
request.setSize(10); // <1>
10031002
// end::update-by-query-request-size
@@ -1112,10 +1111,9 @@ public void testDeleteByQuery() throws Exception {
11121111
// tag::delete-by-query-request-conflicts
11131112
request.setConflicts("proceed"); // <1>
11141113
// end::delete-by-query-request-conflicts
1115-
// tag::delete-by-query-request-typeOrQuery
1116-
request.setDocTypes("doc"); // <1>
1117-
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <2>
1118-
// end::delete-by-query-request-typeOrQuery
1114+
// tag::delete-by-query-request-query
1115+
request.setQuery(new TermQueryBuilder("user", "kimchy")); // <1>
1116+
// end::delete-by-query-request-query
11191117
// tag::delete-by-query-request-size
11201118
request.setSize(10); // <1>
11211119
// 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)