2013-08-28 19:24:34 -04:00
|
|
|
[[query-dsl]]
|
|
|
|
= Query DSL
|
|
|
|
|
|
|
|
[partintro]
|
|
|
|
--
|
|
|
|
*elasticsearch* provides a full Query DSL based on JSON to define
|
|
|
|
queries. In general, there are basic queries such as
|
|
|
|
<<query-dsl-term-query,term>> or
|
|
|
|
<<query-dsl-prefix-query,prefix>>. There are
|
|
|
|
also compound queries like the
|
2015-05-05 02:27:52 -04:00
|
|
|
<<query-dsl-bool-query,bool>> query.
|
|
|
|
|
|
|
|
While queries have scoring capabilities, in some contexts they will
|
|
|
|
only be used to filter the result set, such as in the
|
2013-08-28 19:24:34 -04:00
|
|
|
<<query-dsl-filtered-query,filtered>> or
|
|
|
|
<<query-dsl-constant-score-query,constant_score>>
|
2015-05-05 02:27:52 -04:00
|
|
|
queries.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
2015-05-05 02:27:52 -04:00
|
|
|
Think of the Query DSL as an AST of queries.
|
|
|
|
Some queries can be used by themselves like the
|
|
|
|
<<query-dsl-term-query,term>> query but other queries can contain
|
|
|
|
queries (like the <<query-dsl-bool-query,bool>> query), and each
|
|
|
|
of these composite queries can contain *any* query of the list of
|
|
|
|
queries, resulting in the ability to build quite
|
2013-08-28 19:24:34 -04:00
|
|
|
complex (and interesting) queries.
|
|
|
|
|
2015-05-05 02:27:52 -04:00
|
|
|
Queries can be used in different APIs. For example,
|
2013-08-28 19:24:34 -04:00
|
|
|
within a <<search-request-query,search query>>, or
|
2014-08-13 09:43:47 -04:00
|
|
|
as an <<search-aggregations-bucket-filter-aggregation,aggregation filter>>.
|
2015-05-05 02:27:52 -04:00
|
|
|
This section explains the queries that can form the AST one can use.
|
2013-08-28 19:24:34 -04:00
|
|
|
|
|
|
|
--
|
|
|
|
|
2015-05-05 02:27:52 -04:00
|
|
|
include::query-dsl/index.asciidoc[]
|