ElasticSearch
ES 是开源分布式高可用灵活的搜索引擎 基于 Lucene
正确的顺序:
ES安装x-pack
ES启动
设置密码
Kibana 安装 x-pack
修改Kibana的配置文件
启动Kibana
ELK ElasticSearch(核心) Logstash(采集?) Kibana(可视化)
常见CURD操作 PUT GET POST DELETE
PUT person/doc/1
{
"name":"frank",
"age":18,
"gender":"Male",
"DOB":"19900101"
}
PUT person/doc/2
{
"name":"tom",
"age":19,
"gender":"Male",
"DOB":"19880203"
}
GET person/doc/_search
GET person/doc/_search?q=age:19
POST person/doc/1/_update
{
"doc":{
"age":16
}
}
DELETE person
POST person/doc/_delete_by_query?q=name:frank
GET person/doc/_search
{"query":{
"match":{
"age":18
}
}}
GET person/doc/_search
{"query":{
"match":{
"name":"frank tom"
}
}}
# 排序
GET person/doc/_search
{
"query": {
"match_all": {}
}
, "sort": [
{
"age": {
"order": "desc"
}
}
]
}
分页
GET person/doc/_search
{
"query": {
"match_all": {}
}
, "sort": [
{
"age": {
"order": "desc"
}
}
],
"from": 0,
"size": 1
}
GET person/doc/_search
{
"query": {
"bool": {
"should": [
{"match": {
"name": "frank"
}
},
{"match": {
"age": 19
}}
]
}
},
"sort": [
{
"age": {
"order": "desc"
}
}
],
"from": 0,
"size": 2
}
GET person/doc/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"name": "frank"
}
},
{"match":{
"gender":"Male"
}}
],
"must": [
{"match": {
"age": "18"
}}
]
}
}
}
GET person/doc/_search
{
"query": {
"bool": {
"filter": {
"range": {
"age": {
"gte": 18,
"lte": 20
}
}
}
}
}
}
如果有来生,一个人去远行,看不同的风景,感受生命的活力。。。