Elasticsearch常用操作
1、修改elastic超级用户密码
curl -u elastic -XPUT 'http://192.168.1.14:9200/_xpack/security/user/elastic/_password?pretty' -H 'Content-Type: application/json' -d '{ "password" : "xxx" }'
2、创建一个索引
创建索引(默认设置 )
curl -u elastic:xxx -XPUT 'http://192.168.1.14:9200/my_test_index_001'
创建索引(设置主分片数量)
curl -u elastic:xxx -XPUT 'http://192.168.1.14:9200/my_test_index_002' -H 'Content-Type: application/json' -d '{ "settings": {"number_of_shards" : 1, "number_of_replicas": 0 } }'
3、删除一个索引
curl -u elastic:xxx -XDELETE 'http://192.168.1.14:9200/my_test_index_002'
4、删除所有索引
curl -u elastic:xxx -XDELETE 'http://192.168.1.14:9200/_all'