Skip to content

Commit b42804d

Browse files
elasticjavaChristoph Büscher
authored and
Christoph Büscher
committed
[Docs] REST high-level client: Fix code for most basic search request (#28916)
We also need to add the query to the request.
1 parent bcfb7ab commit b42804d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public void testSearch() throws Exception {
129129
SearchRequest searchRequest = new SearchRequest(); // <1>
130130
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); // <2>
131131
searchSourceBuilder.query(QueryBuilders.matchAllQuery()); // <3>
132+
searchRequest.source(searchSourceBuilder); // <4>
132133
// end::search-request-basic
133134
}
134135
{

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

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-basic]
1818
<1> Creates the `SeachRequest`. Without arguments this runs against all indices.
1919
<2> Most search parameters are added to the `SearchSourceBuilder`. It offers setters for everything that goes into the search request body.
2020
<3> Add a `match_all` query to the `SearchSourceBuilder`.
21+
<4> Add the `SearchSourceBuilder` to the `SeachRequest`.
2122

2223
===== Optional arguments
2324

0 commit comments

Comments
 (0)