目录
- 一、初始化文档数据
- 二、单字段排序文档
- 2.1、概述
- 2.2、示例
 
 
一、初始化文档数据
-  在 Postman 中,向 ES 服务器发 POST 请求 :http://localhost:9200/user/_doc/1,请求体内容为: { "name":"zhangsan", "age":20, "sex":"男" } 
-  在 Postman 中,向 ES 服务器发 POST 请求 :http://localhost:9200/user/_doc/2,请求体内容为: { "name":"zhangsan1", "age":21, "sex":"男" } 
-  在 Postman 中,向 ES 服务器发 POST 请求 :http://localhost:9200/user/_doc/3,请求体内容为: { "name":"zhangsan2", "age":22, "sex":"男" } 
-  在 Postman 中,向 ES 服务器发 POST 请求 :http://localhost:9200/user/_doc/4,请求体内容为: { "name":"lisi", "age":25, "sex":"女" } 
二、单字段排序文档
2.1、概述
- sort可以让我们按照不同的字段进行排序,并且通过- order指定排序的方式。desc 降序,asc升序。
2.2、示例
-  在 Postman 中,向 ES 服务器发 GET请求 :http://localhost:9200/user/_search,请求体内容为: { "query": { "fuzzy": { "name": { "value": "zhangsan" } } }, "sort": [{ "age": { "order":"asc" } }] } 
-  服务器响应结果 
  


















