query-dsl.asciidoc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. [[query-dsl]]
  2. = Query DSL
  3. [partintro]
  4. --
  5. *elasticsearch* provides a full Query DSL based on JSON to define
  6. queries. In general, there are basic queries such as
  7. <<query-dsl-term-query,term>> or
  8. <<query-dsl-prefix-query,prefix>>. There are
  9. also compound queries like the
  10. <<query-dsl-bool-query,bool>> query. Queries can
  11. also have filters associated with them such as the
  12. <<query-dsl-filtered-query,filtered>> or
  13. <<query-dsl-constant-score-query,constant_score>>
  14. queries, with specific filter queries.
  15. Think of the Query DSL as an AST of queries. Certain queries can contain
  16. other queries (like the
  17. <<query-dsl-bool-query,bool>> query), others can
  18. contain filters (like the
  19. <<query-dsl-constant-score-query,constant_score>>),
  20. and some can contain both a query and a filter (like the
  21. <<query-dsl-filtered-query,filtered>>). Each of
  22. those can contain *any* query of the list of queries or *any* filter
  23. from the list of filters, resulting in the ability to build quite
  24. complex (and interesting) queries.
  25. Both queries and filters can be used in different APIs. For example,
  26. within a <<search-request-query,search query>>, or
  27. as an <<search-aggregations-bucket-filter-aggregation,aggregation filter>>.
  28. This section explains the components (queries and filters) that can form the
  29. AST one can use.
  30. Filters are very handy since they perform an order of magnitude better
  31. than plain queries since no scoring is performed and they are
  32. automatically cached.
  33. --
  34. include::query-dsl/queries.asciidoc[]
  35. include::query-dsl/filters.asciidoc[]