Files
vf_react/es_index_rebuild.json
2026-01-06 16:00:37 +08:00

156 lines
4.8 KiB
JSON

{
"说明": "社区模块 ES 索引重建脚本",
"执行步骤": [
"1. 删除旧索引(如果存在)",
"2. 创建新索引",
"3. 数据会随着用户使用自动写入"
],
"索引1_帖子": {
"删除命令": "DELETE /community_forum_posts",
"创建命令": "PUT /community_forum_posts",
"mapping": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"ik_smart_analyzer": {
"type": "custom",
"tokenizer": "ik_smart"
}
}
}
},
"mappings": {
"properties": {
"id": { "type": "keyword" },
"channel_id": { "type": "keyword" },
"author_id": { "type": "keyword" },
"author_name": { "type": "keyword" },
"author_avatar": { "type": "keyword" },
"title": {
"type": "text",
"analyzer": "ik_smart_analyzer",
"fields": {
"keyword": { "type": "keyword", "ignore_above": 256 }
}
},
"content": {
"type": "text",
"analyzer": "ik_smart_analyzer"
},
"content_html": {
"type": "text",
"index": false
},
"tags": { "type": "keyword" },
"stock_symbols": { "type": "keyword" },
"is_pinned": { "type": "boolean" },
"is_locked": { "type": "boolean" },
"is_deleted": { "type": "boolean" },
"reply_count": { "type": "integer" },
"view_count": { "type": "integer" },
"like_count": { "type": "integer" },
"last_reply_at": { "type": "date" },
"last_reply_by": { "type": "keyword" },
"created_at": { "type": "date" },
"updated_at": { "type": "date" }
}
}
}
},
"索引2_回复": {
"删除命令": "DELETE /community_forum_replies",
"创建命令": "PUT /community_forum_replies",
"mapping": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"ik_smart_analyzer": {
"type": "custom",
"tokenizer": "ik_smart"
}
}
}
},
"mappings": {
"properties": {
"id": { "type": "keyword" },
"post_id": { "type": "keyword" },
"channel_id": { "type": "keyword" },
"author_id": { "type": "keyword" },
"author_name": { "type": "keyword" },
"author_avatar": { "type": "keyword" },
"content": {
"type": "text",
"analyzer": "ik_smart_analyzer"
},
"content_html": {
"type": "text",
"index": false
},
"reply_to": {
"type": "object",
"properties": {
"replyId": { "type": "keyword" },
"authorId": { "type": "keyword" },
"authorName": { "type": "keyword" },
"contentPreview": { "type": "keyword" }
}
},
"reactions": { "type": "object", "enabled": false },
"like_count": { "type": "integer" },
"is_solution": { "type": "boolean" },
"is_deleted": { "type": "boolean" },
"created_at": { "type": "date" }
}
}
}
},
"索引3_消息": {
"删除命令": "DELETE /community_messages",
"创建命令": "PUT /community_messages",
"mapping": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"properties": {
"id": { "type": "keyword" },
"channel_id": { "type": "keyword" },
"author_id": { "type": "keyword" },
"author_name": { "type": "keyword" },
"author_avatar": { "type": "keyword" },
"content": { "type": "text" },
"mentioned_users": { "type": "keyword" },
"mentioned_stocks": { "type": "keyword" },
"attachments": { "type": "object", "enabled": false },
"embeds": { "type": "object", "enabled": false },
"reactions": { "type": "object", "enabled": false },
"reply_to": {
"type": "object",
"properties": {
"messageId": { "type": "keyword" },
"authorId": { "type": "keyword" },
"authorName": { "type": "keyword" },
"contentPreview": { "type": "keyword" }
}
},
"thread_id": { "type": "keyword" },
"is_pinned": { "type": "boolean" },
"is_edited": { "type": "boolean" },
"is_deleted": { "type": "boolean" },
"created_at": { "type": "date" },
"updated_at": { "type": "date" }
}
}
}
}
}