2017-09-06 08:06:41 -04:00
|
|
|
[[java-rest-high-java-builders]]
|
|
|
|
== Using Java Builders
|
|
|
|
|
|
|
|
The Java High Level REST Client depends on the Elasticsearch core project which provides
|
|
|
|
different types of Java `Builders` objects, including:
|
|
|
|
|
|
|
|
Query Builders::
|
|
|
|
|
|
|
|
The query builders are used to create the query to execute within a search request. There
|
|
|
|
is a query builder for every type of query supported by the Query DSL. Each query builder
|
|
|
|
implements the `QueryBuilder` interface and allows to set the specific options for a given
|
|
|
|
type of query. Once created, the `QueryBuilder` object can be set as the query parameter of
|
2018-09-28 14:48:11 -04:00
|
|
|
`SearchSourceBuilder`. The <<java-rest-high-search-request-building-queries, Search Request>>
|
2017-09-06 08:06:41 -04:00
|
|
|
page shows an example of how to build a full search request using `SearchSourceBuilder` and
|
|
|
|
`QueryBuilder` objects. The <<java-rest-high-query-builders, Building Search Queries>> page
|
|
|
|
gives a list of all available search queries with their corresponding `QueryBuilder` objects
|
|
|
|
and `QueryBuilders` helper methods.
|
|
|
|
|
|
|
|
Aggregation Builders::
|
|
|
|
|
|
|
|
Similarly to query builders, the aggregation builders are used to create the aggregations to
|
|
|
|
compute during a search request execution. There is an aggregation builder for every type of
|
|
|
|
aggregation (or pipeline aggregation) supported by Elasticsearch. All builders extend the
|
|
|
|
`AggregationBuilder` class (or `PipelineAggregationBuilder`class). Once created, `AggregationBuilder`
|
|
|
|
objects can be set as the aggregation parameter of `SearchSourceBuilder`. There is a example
|
|
|
|
of how `AggregationBuilder` objects are used with `SearchSourceBuilder` objects to define the aggregations
|
2018-09-28 14:48:11 -04:00
|
|
|
to compute with a search query in <<java-rest-high-search-request-building-aggs, Search Request>> page.
|
2017-09-06 08:06:41 -04:00
|
|
|
The <<java-rest-high-aggregation-builders, Building Aggregations>> page gives a list of all available
|
|
|
|
aggregations with their corresponding `AggregationBuilder` objects and `AggregationBuilders` helper methods.
|
|
|
|
|
2018-02-02 11:19:50 -05:00
|
|
|
include::query-builders.asciidoc[]
|
|
|
|
include::aggs-builders.asciidoc[]
|