Skip to content

Commit

Permalink
update README with search by template example
Browse files Browse the repository at this point in the history
  • Loading branch information
bobby-garmin committed Dec 9, 2015
1 parent 1f04896 commit 4b08f35
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions jest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,25 @@ Search search = new Search.Builder(query)
SearchResult result = client.execute(search);
```

By template;
``` java
String query = "{\n" +
" \"id\": \"myTemplateId\",
" \"params\": {\n" +
" \"query_string\" : \"search for this\"
" }\n" +
"}";
Search search = new Search.TemplateBuilder(query)
// multiple index or types can be added.
.addIndex("twitter")
.addIndex("tweet")
.build();
SearchResult result = client.execute(search);
```
Also supports inline search templates and file-based templates.
By using SearchSourceBuilder;
```java
Expand Down

0 comments on commit 4b08f35

Please sign in to comment.