Files
my-chat_-server/message/test/es_test/请求格式规范.txt
2025-10-13 18:34:48 +08:00

73 lines
1.6 KiB
Plaintext

POST /message/_doc
{
"settings" : {
"analysis" : {
"analyzer" : {
"ik" : {
"tokenizer" : "ik_max_word"
}
}
}
},
"mappings" : {
"dynamic" : true,
"properties" : {
"chat_session_id" : {
"type" : "keyword",
"analyzer" : "standard"
},
"message_id" : {
"type" : "keyword",
"analyzer" : "standard"
},
"content" : {
"type" : "text",
"analyzer" : "ik_max_word"
}
}
}
}
GET /message/_doc/_search?pretty
{
"query": {
"match_all": {}
}
}
POST /message/_doc/_bulk
{"index":{"_id":"1"}}
{"chat_session_id" : "会话ID1","message_id" : "消息ID1","content" : "吃饭了么?"}
{"index":{"_id":"2"}}
{"chat_session_id" : "会话ID1","message_id" : "消息ID2","content" : "吃的盖浇饭。"}
{"index":{"_id":"3"}}
{"chat_session_id" : "会话ID2","message_id" : "消息ID3","content" : "昨天吃饭了么?"}
{"index":{"_id":"4"}}
{"chat_session_id" : "会话ID2","message_id" : "消息ID4","content" : "昨天吃的盖浇饭。"}
GET /message/_doc/_search?pretty
{
"query": {
"bool": {
"must": [
{
"term": {
"chat_session_id.keyword": "会话ID1"
}
},
{
"match": {
"content": "盖浇饭"
}
}
]
}
}
}
DELETE /message