1,打开到对应的x-shell ip ,su XXX ,切换用户, 查看index 。
命令: curl -u root:111111 -XGET http://192.168.31.12:9200/_cat/indices?v
2.创建index:
//查询213索引
curl -u root:111111 -XGET http://172.16.17.213:9200/_cat/indices?v
//查询.action索引 数据
curl -u root:111111 'http://172.16.17.213:9200/test/_search?pretty'
//创建新的索引test
curl -u root:111111 -XPUT 'http://172.16.17.213:9200/test?pretty'
//往test 上添加数据
//删除索引test
curl -u root:111111 -XDELETE 'http://172.16.17.213:9200/test?pretty'
//创建224索引
curl -u elastic:123456 -XPUT 'http://172.16.17.224:9201/test?pretty'
//查询语句224
curl -u elastic:123456 -XGET http://172.16.17.224:9201/_cat/indices?v
//添加数据的语句
curl -u elastic:123456 -XPUT 'http://172.16.17.224:9201/test/Test/3' -d '{
"name" : "张三",
"post_date" : "2019-11-15T14:12:12",
"message" : 22
}'
//对的
curl -u root:111111 -H "Content-Type: application/json" -XPUT 'http://172.16.17.213:9200/test2/Test/3' -d '{
"name" : "张三",
"post_date" : "2019-11-15T14:12:12",
"message" : "13914528546"
}'