Skip to content

Commit

Permalink
[Docs] REST high-level client: Fix code for most basic search request (
Browse files Browse the repository at this point in the history
…elastic#28916)

We also need to add the query to the request.
  • Loading branch information
elasticjava authored and Christoph Büscher committed Mar 8, 2018
1 parent 781d830 commit 924247d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ public void testSearch() throws IOException {
SearchRequest searchRequest = new SearchRequest(); // <1>
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); // <2>
searchSourceBuilder.query(QueryBuilders.matchAllQuery()); // <3>
searchRequest.source(searchSourceBuilder); // <4>
// end::search-request-basic
}
{
Expand Down
1 change: 1 addition & 0 deletions docs/java-rest/high-level/apis/search.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include-tagged::{doc-tests}/SearchDocumentationIT.java[search-request-basic]
<1> Creates the `SeachRequest`. Without arguments this runs against all indices.
<2> Most search parameters are added to the `SearchSourceBuilder`. It offers setters for everything that goes into the search request body.
<3> Add a `match_all` query to the `SearchSourceBuilder`.
<4> Add the `SearchSourceBuilder` to the `SeachRequest`.

===== Optional arguments

Expand Down

0 comments on commit 924247d

Please sign in to comment.