# 9.3.7 Request Body和Query DSL简介

* 将查询语句通过HTTP Request Body发送给Elasticsearch
* Query DSL

举例

![](/files/-LoUY5Lw0aNf14X6CudP)

## 分页

* From从0开始，默认返回10个结果
* 获取靠后的翻页成本较高

![](/files/-LoUY5M2Y0qpKXkGOGBl)

## 排序

* 最好在"数字型"与"日期型"字段上排序
  * 因为对于多值类型或分析过的字段排序，系统会选一个值，无法得知该值

![](/files/-LoUY5M6TsumFFC3NHhE)

## \_source filtering

* 如果\_source没有存储，那就只返回匹配的文档的元数据
* \_source支持使用通配符\_source\["name\*","desc\*"]

![](/files/-LoUY5MBGFQxMbJ9iWLJ)

## 脚本字段

* 用例：订单中有不同的汇率，需要结合汇率对，订单价格进行排序

![](/files/-LoUY5MDv73u1V7XcRxa)

## 使用查询表达式 - Match

* 默认使用term类型，或的关系

![](/files/-LoUY5MFXW1pzwJ1XvaV)

* 可以指定操作类型为AND

![](/files/-LoUY5MHSGRO1i5k2L49)

## 短语搜索 - Match Phrase

* slop参数表示，允许各个单词之间插入的单词个数

![](/files/-LoUY5MJ0dEIncWam9tj)


---

# 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://wiki.clay-wangzhi.com/9-elasticsearch/9.3-elasticsearch-ru-men/9.3.7-request-body-he-query-dsl-jian-jie.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.
