public class ElasticSearchDataSource extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static ElasticSearchUtil |
es |
static int |
PORT_DEFAULT |
| 构造器和说明 |
|---|
ElasticSearchDataSource(Map<String,String> config) |
ElasticSearchDataSource(String hostname,
int port,
String scheme,
String username,
String password,
String indexName)
创建 ElasticSearch 实现
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
commit(String table,
List<Map<String,Object>> list) |
void |
init(String hostname,
int port,
String scheme,
String username,
String password) |
LogListVO |
list(String table,
String query,
int everyPageNumber,
int currentPage)
同上面的 list,只不过这里可以自定义操作 indexName。
|
static void |
main(String[] args) |
public static final int PORT_DEFAULT
public static ElasticSearchUtil es
public ElasticSearchDataSource(String hostname, int port, String scheme, String username, String password, String indexName)
hostname - 主机,传入如 127.0.0.1port - 端口,传入如 9200scheme - 协议,传入如 httpusername - 登录用户名,如果es未设置账号密码,则此项无需传入,传入null即可password - 登录密码,如果es未设置账号密码,则此项无需传入,传入null即可indexName - 索引名字,理解上类似于数据表的名字,要存储的数据是存到哪个表public static void main(String[] args)
public LogListVO list(String table, String query, int everyPageNumber, int currentPage)
获取到的数据排序规则:这里是按照数据加入的顺序,倒序排列,插入越往后的,显示越靠前
indexName - 索引名字query - 查询条件,传入如: name:guanleiming AND age:123everyPageNumber - 每页显示几条,最大200request - Copyright © 2024. All rights reserved.