ES索引基本使用(一)

韵味老鸟 2024-08-06 12:44:39

ES索引基本使用

#查看ES支持的列表

curl http://node1:9200/_cat/?

#查看ES健康状态

curl http://node1:9200/_cat/health?v -u elastic:Meng@20

#查看ES节点状态

curl http://node1:9200/_cat/nodes?v -u elastic:Meng@20

#查看ES分片

curl http://node1:9200/_cat/shards -u elastic:Meng@20

#查看索引

curl http://node1:9200/_cat/indices?v -u elastic:Meng@20

###实例操作

1.创建索引

curl -XPUT 'node1:9200/customer?pretty' -u elastic:Meng@20

2.创建文档

#index customer

#type external

#document id 1 content "name:cdh-dev"

curl -XPUT -H "Content-Type: application/json" -u elastic:Meng@20 'node1:9200/customer/_doc/2?pretty' -d '

{

"name": "cdh-dev1"

}'

#Post方式不带ID值

curl -XPOST -H "Content-Type: application/json" -u elastic:Meng@20 'node1:9200/customer/_doc/1?pretty' -d '

{

"name": "dev-cdh"

}'

0 阅读:0