# 3.5.Query DSL(DSL方式查询)

**Elasticsearch** 提供了一个基于 **JSON** 的完整的查询 **DSL** 来定义查询。将查询 **DSL** 视为查询的 **AST**，由两种类型的子句组成：

* **叶查询子句**

叶查询子句在特定查询中查找特定值，例如匹配、项值、范围查询。这些查询都可以给自己使用。

* **复合查询子句**

复合查询子句包装其他叶子或复合查询，用于以逻辑方式组合多个查询（例如 **bool** 或 **dis\_max** 查询），或更改其行为（如 **constant\_score** 查询）。

查询子句的行为有所不同，具体取决于它们是在查询上下文还是过滤器上下文中使用。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/35query-dsldslfang-shi-cha-8be229.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
