elasticsearch 常用的操作
2018-06-22 本文已影响0人
HelloWorld_26
- 查看当前集群的状态
curl 'http://IP:PORT/_cat/health?v'
2.查看当前node
curl 'http://IP:PORT/_cat/nodes?v'
3.查看所有的index
curl 'http://IP:PORT/_cat/indices?v'
4.创建一个index
curl -XPUT 'IP:PORT/customer?pretty'
5.创建一个index 带有文档的
curl -XPUT 'IP:PORT/customer/external/1?pretty' -d '
{
"name": "John Doe"
}'
6.删除一个index
curl -XDELETE 'IP:PORT/customer?pretty'
curl -XDELETE 'IP:PORT/onland-*?pretty’
curl -XDELETE 'IP:PORT/test.*.2017'
awk '{print $3}' a.txt |grep 01.*.2017
[ec2-user@ip ~]$curl 'http://IP:PORT/_cat/indices?v’ > a.txt
[ec2-user@ip ~]$ curl 'http://IP:PORT/_cat/indices?v'; > a.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 106k 100 106k 0 0 63398 0 0:00:01 0:00:01 --:--:-- 63425
[ec2-user@ip ~]$ awk '{print $3}' a.txt > b.txt
[ec2-user@ip ~]$ ls
a.txt b.txt