chore(http-client): 添加 Elasticsearch 索引和文档操作示例
- 新增创建索引的 HTTP 请求示例 - 添加多个创建文档的 PUT 请求示例 - 包含不同类型内容的文档数据(旅游、美食、穿搭) - 提供基于 multi_match 的搜索文档示例 - 所有请求均针对 note 索引进行操作 - 补充完整的请求体和时间字段内容
This commit is contained in:
@@ -228,4 +228,54 @@ Authorization: Bearer {{otherToken}}
|
|||||||
|
|
||||||
{
|
{
|
||||||
"id": 1977249693272375330
|
"id": 1977249693272375330
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### 创建索引
|
||||||
|
PUT http://localhost:9200/note
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
### 创建文档
|
||||||
|
PUT http://localhost:9200/note/_doc/1
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"title": "夏日旅游攻略",
|
||||||
|
"content": "去海边玩耍的必备攻略,推荐三亚和青岛。",
|
||||||
|
"create_time": "2024-08-16 16:49:35"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 创建文档
|
||||||
|
PUT http://localhost:9200/note/_doc/2
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"title": "美食笔记",
|
||||||
|
"content": "推荐几家成都的火锅店,真的很辣很过瘾!",
|
||||||
|
"create_time": "2024-11-02 17:00:36"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 创建文档
|
||||||
|
PUT http://localhost:9200/note/_doc/3
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"title": "秋季穿搭指南",
|
||||||
|
"content": "分享适合秋天的服装搭配技巧,风衣必不可少。",
|
||||||
|
"create_time": "2024-11-03 16:59:58"
|
||||||
|
}
|
||||||
|
|
||||||
|
### 搜索文档
|
||||||
|
GET http://localhost:9200/note/_search
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"query": {
|
||||||
|
"multi_match": {
|
||||||
|
"query": "攻略",
|
||||||
|
"fields": [
|
||||||
|
"title",
|
||||||
|
"content"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user