时间:2021-07-01 10:21:17 帮助过:61人阅读
2.curl http://172.16.18.17:9200/_cat
_cat:列出es命令参数
=^.^= /_cat/allocation /_cat/shards /_cat/shards/{index} /_cat/master /_cat/nodes /_cat/tasks /_cat/indices /_cat/indices/{index} /_cat/segments /_cat/segments/{index} /_cat/count /_cat/count/{index} /_cat/recovery /_cat/recovery/{index} /_cat/health /_cat/pending_tasks /_cat/aliases /_cat/aliases/{alias} /_cat/thread_pool /_cat/thread_pool/{thread_pools} /_cat/plugins /_cat/fielddata /_cat/fielddata/{fields} /_cat/nodeattrs /_cat/repositories /_cat/snapshots/{repository} /_cat/templatesView Code
3.curl http://172.16.18.17:9200/_cat/indices?v
?v 列出查询详细结果(带属性标识)
4.创建索引
curl -XPUT http://192.168.6.16:9200/my_new_index?pretty
?pretty:“pretty”来告诉Elasticsearch,做JSON格式化输出
5.插入数据
(1)错误方法
此原因时由于ES增加了安全机制, 进行严格的内容类型检查,严格检查内容类型也可以作为防止跨站点请求伪造攻击的一层保护。
(2)解决,增加-H
curl -H "Content-Type: application/json" -XPUT http://172.16.18.17:9200/index_test/user/1?pretty -d ‘{"name":"张三","age":"23"}‘
6.查询数据
curl -XGET http://172.16.18.17:9200/index_test/user/1?pretty
7.更新数据
curl -XPOST http://192.168.6.16:9200/my_new_index/user/2/_update?pretty -d ‘{"doc":{"name":"李四更新","age":"230"}}
8.删除数据
curl -XDELETE http://192.168.6.16:9200/my_new_index/user/2?pretty
9.查询某个索引中的所有数据
curl -XGET http://172.16.18.17:9200/index_test/user/_search?pretty
【数据库-ES】ES基本操作
标签:检查 style 防止 hid har splay img let curl