MySQL中数据表创建
CREATE TABLE `weibo_hot_list` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rank` int(11) DEFAULT 100 COMMENT '排名',
`title` varchar(300) DEFAULT 'Title' COMMENT '标题',
`link` varchar(500) DEFAULT 'Link' COMMENT '链接',
`public_name` varchar(50) DEFAULT 'Public Name' COMMENT '公共号',
`hot_number` int(11) DEFAULT 0 COMMENT '热度指数',
`detail` text COMMENT '详情',
`timestamp` datetime COMMENT '时间',
`u_id` int COMMENT '外键',
PRIMARY KEY (`id`),
KEY `u_id` (`u_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
有第一张表后创建其他相同类型的表:
create table niuke_hot_list like weibo_hot_list;
Elasticsearch mapping设置
PUT weibo_data
{
"mappings" : {
"properties" : {
"title_text" : {
"type" : "text",
"analyzer": "ik_max_word",
"search_analyzer": "ik_smart"
},
"title_keyword" : {
"type" : "keyword"
},
"rank" : {
"type" : "integer"
},
"hot_number" : {
"type" : "integer"
},
"timestamp" : {
"type" : "date"
},
"u_id":{
"type": "integer"
}
}
}
}
更新IK词典后更新:
POST weibo_data/_update_by_query
{
}
网友评论