ELK series one ElasticSearch Kibana low code programming 01

ElasticSearch installation

Insert picture description here
Insert picture description here

note

Insert picture description here

es plugin

npm install
npm run start

Insert picture description here


can be
http://127.0.0.1:9200/
http://localhost:9200/

Insert picture description here


after installing Kibana

Insert picture description here

Other configuration

Insert picture description here

Change to Chinese i18n.locale: "zh"

Insert picture description here

Installation

Insert picture description here

experience more growth of luck

Insert picture description here


good character to enter here is not good on a variety of start all over again , right QAQ

Insert picture description here


HTTP: // localhost: 5601 /
bells and whistles try something login page

Insert picture description here


Papa function,

Insert picture description here


play with it

Insert picture description here

Insert data

DELETE /clayindex
insert index clayindex and data

Insert picture description here


PUT /clayindex
{ "mappings": { "properties": { "name":{ "type": "keyword" }, "address":{ "type": "text" }, "Age":{ "type": "integer" } } } } -------------------Insert data #Insert data can generate id by yourself // POST /clayindex/ _doc { “name”: “Cao Cao”, “address”: “Wei State”, “age”: 18 } POST /clayindex/_doc { “name”: “贾诩”, “address”: “Wei State”, “ age":19 } POST /clayindex/_doc { "name":" Zhugeliang ",































"Address":"Shu",
"age":37
}
POST /clayindex/_doc
{ "name":"关羽", "address":" shu ", "age":35 } POST /clayindex/_doc { "Name":"周瑜", "address":["吴国","shu country"], "age":25 }









Sort
GET clayindex/_doc/_search
{ "query":{ "match": { "address": "魏国" } }, "_source":["name"], "sort":[ {"age":{ "Order":"desc"}}, {"name":{"order":"asc"}} ] }










Insert picture description here

#分页
GET clayindex/_doc/_search
{ "query":{ "match": { "address": "魏国" } }, "_source":["name"], "sort":[ {"age": {"Order":"desc"}}, {"name":{"order":"asc"}} ], "from":0, "size":10 } #condition 1 or condition 2 GET clayindex/_doc /_search { "query":{ "bool": { "should": [ { "match": { "address": "魏国" }






















      },{
        "match": {
   "name": "曹操"
 }
        
      }
    ]
    
  }

},
"_source":["name"],
"sort":[
{"age":{"order":"desc"}},
{"name":{"order":"asc"}}
],
"From":0,
"size":10
}
#excluding MUST_NOT #Query
information whose name is not Cao Cao
GET clayindex/_doc/_search
{ "query":{

"bool": {
  "must_not": [
    {
       "match": {
   "name": "曹操"
    
 }
    }
  ]
}

}
} #Data
filter FILTER #gt greater
than
#gte greater than or equal to
#lt less than
#lte less than or equal to!

The query name is Cao Cao, and the age is greater than or equal to 10 and less than or equal to 30

GET clayindex/_doc/_search
{ "query":{

"bool": {
  "must": [
    {
       "match": {
   "name": "曹操"
    
 }
    }
  ],
  "filter": {
    "range": {
      "age": {
        "gte": 10,
        "lte": 20
      }
    }
  }
} 

}
}

Highlight query

# Highlighted query
GET clayindex / _doc / _search
{ "Query": { "match": { "name": "Cao Cao" } }, "highlight": {





"fields": {
  "name": {}
}

}
}

GET clayindex/_doc/_search
{ "query":{ "match": { "address": "魏国" } }, "highlight":{ "fields": { "address": {} } } }











Insert picture description here

Custom highlight style

Clayindex GET / _doc / _search
{ "Query": { "match": { "name": "Cao Cao"



}
},
“highlight”:{

"pre_tags": "<p class='gaoliang'>", 
"post_tags": "</p>", 
"fields": {
  "name": {}
}

}
}

Multiple conditions and multiple fields highlight query

Clayindex the GET / _doc / _search
{ "Query": { "BOOL": { "MUST": [ { "match": { "address": "Wei" } }, { "match": { "name": "Cao Cao" } } ]













  }

},
“highlight”:{

"pre_tags": "<p class='gaoliang'>", 
"post_tags": "</p>", 
"fields": [
  {"name": {}},
   {"address": {}}

]
}
}

Insert picture description here

Aggregate query

Bucket:
Data grouping. Some data is divided into buckets according to a certain field. Data with the same field value is put into a bucket. Similar to the query result after group by in Mysql. metric: statistical executing a data packet, such as computing the maximum, minimum, average and other similar Mysql in max (), min (), the value of AVG () function, are used in the group by the .