curl -k -u elastic:elastic -XGET http://192.168.151.182:9200/_search?pretty
curl -k -u elastic:elastic 'http://192.168.151.182:9200/_cat/indices?v'
curl -k -u elastic:elastic -XGET 'http://192.168.151.182:9200/c_index/_mapping?pretty'
curl -k -u elastic:elastic -H 'Content-Type: application/json' -XPUT http://192.168.151.182:9200/c_index -d '
{
"mappings": {
"properties": {
"id": {
"type": "integer"
},
"country": {
"type": "text"
},
"city": {
"type": "text"
}
}
}
}'
curl -k -u elastic:elastic -XDELETE http://192.168.151.182:9200/c_index
curl -k -u elastic:elastic 'http://192.168.151.182:9200/_cat/aliases?v&pretty'
curl -k -u elastic:elastic -H 'Content-Type: application/json' -XPOST 'http://192.168.151.182:9200/_aliases' -d '
{
"actions": [
{"add": {"index": "demo", "alias": "alias1"}}
]
}'
curl -k -u elastic:elastic -H 'Content-Type: application/json' -XPOST 'http://192.168.151.182:9200/_aliases' -d '
{
"actions": [
{"remove": {"index": "demo", "alias": "demod"}}
]
}'
参考文章: elasticsearch别名使用指南 curl命令操作elasticsearch ElasticSearch之CURL操作
|