Elasticsearch
一、es客户端-kibana
没有数据库概念,只有索引
索引=表
建索引:
建空索引(空表):
PUT xxx
注意:如果没有设置表字段类型,则会默认类型
查询所有:
GET xxx/_search
{
"query": {
"match_all": {}
}
}
统计:
GET /xxx/_count
模糊匹配:
GET xxx/_search
{
"query": {
"match_phrase": {
"title":"测试"
}
}
}
或
GET xxx/_search
{
"query": {
"wildcard": {
"source":"*测试*"
}
}
}
IN查询:
GET xxx/_search
{
"query": {
"multi_match": {
"level": [
"测试",
"开发"
]
}
}
}
刷新(如果新修改后,刷新一下):
GET xxx/_refresh
二、java引入es:
1.配置中添加:
elasticsearch:
nodes: xxx:xxx
schema: http
max-connect-total: 50
max-connect-per-route: 10
connection-request-timeout-millis: 500
socket-timeout-millis: 100000
connect-timeout-millis: 30000
username: xxx
password: xxx