ELK
官网:https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
Elasticsearch-基本概念

Elasticsearch-集群部署

Elasticsearch-操作

#检查集群状态
curl -X GET "xxx:9200/_cat/health?v"
#查看集群节点
curl -X GET "xxx:9200/_cat/nodes?v"
#列出所有索引(数据库)
curl -X GET "xxx:9200/_cat/indices?v"
#创建索引(数据库)
curl -X PUT "xxx:9200/logs-test-2022-05-25"
#给索引插入数据
curl -X PUT "xxx:9200/logs-test-2022-05-25/_doc/1?pretty" -H 'Content-Type: application/json' -d '{"name":"liyibo"}'
#查看索引数据
curl -X GET "xxx:9200/logs-test-2022-05-25/_doc/1?pretty"
#删除索引数据
curl -X DELETE "xxx:9200/logs-test-2022-05-25/_doc/1?pretty"
#修改索引数据1相当于删除重写不优雅)
curl -X PUT "xxx:9200/logs-test-2022-05-25/_doc/1?pretty" -H 'Content-Type: application/json' -d '{"name":"liyibo2}'
#修改索引数据2
curl -X POST "xxx:9200/logs-test-2022-05-25/_doc/1/_update?pretty" -H 'Content-Type: application/json' -d '{"name":"liyibo3"}'
curl -X POST "xxx:9200/logs-test-2022-05-25/_doc/1/_update?pretty" -H 'Content-Type: application/json' -d '{"name":"liyibo3","age":12}'
#批处理
curl -X POST "xxx:9200/_bulk?pretty" -H 'Content-Type: application/json' -d'
{ "index" : { "_index" : "test", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_id" : "2" } }
{ "create" : { "_index" : "test", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }
'

浙公网安备 33010602011771号