From c216ca4c63b14136d935a842f0a9164dec24a52b Mon Sep 17 00:00:00 2001 From: Hanserwei <2628273921@qq.com> Date: Mon, 27 Oct 2025 23:04:14 +0800 Subject: [PATCH] =?UTF-8?q?chore(http-client):=20=E6=B7=BB=E5=8A=A0=20Elas?= =?UTF-8?q?ticsearch=20=E7=B4=A2=E5=BC=95=E5=92=8C=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增创建索引的 HTTP 请求示例 - 添加多个创建文档的 PUT 请求示例 - 包含不同类型内容的文档数据(旅游、美食、穿搭) - 提供基于 multi_match 的搜索文档示例 - 所有请求均针对 note 索引进行操作 - 补充完整的请求体和时间字段内容 --- http-client/gateApi.http | 52 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/http-client/gateApi.http b/http-client/gateApi.http index 50f6371..c0a25bc 100644 --- a/http-client/gateApi.http +++ b/http-client/gateApi.http @@ -228,4 +228,54 @@ Authorization: Bearer {{otherToken}} { "id": 1977249693272375330 -} \ No newline at end of file +} + +### 创建索引 +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" + ] + } + } +}