[Docs] REST high-level client: Fix code for most basic search request (#28916)

We also need to add the query to the request.
This commit is contained in:
Holger Bartnick 2018-03-08 13:14:50 +01:00 committed by Christoph Büscher
parent bcfb7ab591
commit b42804d182
2 changed files with 2 additions and 0 deletions

View File

@ -129,6 +129,7 @@ public class SearchDocumentationIT extends ESRestHighLevelClientTestCase {
SearchRequest searchRequest = new SearchRequest(); // <1>
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); // <2>
searchSourceBuilder.query(QueryBuilders.matchAllQuery()); // <3>
searchRequest.source(searchSourceBuilder); // <4>
// end::search-request-basic
}
{

View File

@ -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