Elasticsearch查询文章排序以及分页
风中勁草 2019-10-08 ElasticSearch
在springboot使用elasticsearch进行简单的排序以及分页查询方法,提高查询效率。将配置文件做一些记录方便下一次使用
# 配置文件
# MySQL 配置:地址,用户名,密码
my_addr = "ip:3306"
my_user = "root"
my_pass = "***"
# Elasticsearch地址
es_addr = "ip:端口"
# 存储数据的位置
data_dir = "./var"
# Inner Http status address
stat_addr = "127.0.0.1:12800"
# pseudo server id like a slave
server_id = 1001
# mysql or mariadb
flavor = "mysql"
# mysql备份文件,如果不设置或设置为空,则跳过
# mysqldump = "mysqldump"
# minimal items to be inserted in one bulk
bulk_size = 128
# force flush the pending requests if we don't have enough items >= bulk_size
flush_bulk_time = "200ms"
# Ignore table without primary key
skip_no_pk_table = false
# MySQL数据源,schema:数据库,tables:表
[[source]]
schema = "test"
tables = ["link_info"]
[[rule]]
schema = "test"
table = "link_info"
index = "test_mysql2"
type = "link_info"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 启动
cd $GOPATH/src/github.com/siddontang/go-mysql-elasticsearch
./bin/go-mysql-elasticsearch -config=./etc/river.toml
1
2
2