使用rest api访问elasticsearch6


==> 查询所有index

curl '172.30.6.14:9200/_cat/indices?v'


==> 创建索引

curl -XPUT '172.30.6.14:9200/customer?pretty'

==》指定type并插入文档

curl -H "Content-Type: application/json" -XPUT '172.30.6.14:9200/customer/external/1?pretty' -d '{"name":"John"}'

==》获取指定index下的所有type结构

curl 172.30.6.14:9200/customer/_mappings?pretty

==》查询指定index/type下的mapping

curl '172.30.6.14:9200/customer/_mapping/external?pretty'

==> 删除索引

curl -XDELETE 'localhost:9200/customer?pretty'


 

猜你喜欢

转载自blog.csdn.net/oitebody/article/details/81088584