Elastic常用指令

所有指令需要密码,添加如下代码
-u 用户名:密码 

---查询所有索引指令
curl  -i -XGET http://localhost:9200/_cat/indices?v(不需要用户名密码)
curl -u username:pwd  -i -XGET http://localhost:9200/_cat/indices?v(需要用户名密码)

---查询指定索引的mapping
curl -u username:pwd -X GET "localhost:9200/jc_person_record/_mapping?pretty"

---查询所有索引的settigs
curl -X GET -u username:pwd "http://localhost:9200/_settings?pretty"

---查询指定索引的settigs
curl -u username:pwd  -X GET "http://localhost:9200/jc_person_record/settings?pretty"

---单机部署,所有索引副本置为0
curl -H "Content-Type: application/json" -X PUT 'http://127.0.0.1:9200/_settings' -d '{"index":{"number_of_replicas":0}}'

---新增索引,并指令settings和mappings
curl -u username:pwd -X PUT "localhost:9200/jc_common_address"
{
  "settings": {"index":{"routing":{"allocation":{"include":{"_tier_preference":"data_content"}}},"number_of_shards":"1","provided_name":"jc_common_address","creation_date":"1709777363165","number_of_replicas":"1","uuid":"GC4OdU5pS5KXwAuFkLFzxg","version":{"created":"7171799"}}},
  "mappings": {"properties":{"createBy":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"deleteFlag":{"type":"long"},"gmtCreate":{"type":"long"},"gmtModified":{"type":"long"},"id":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"isDisplay":{"type":"long"},"isFinal":{"type":"long"},"level":{"type":"long"},"name":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"pid":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"pids":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"pnames":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}}}}
}


---删除指定索引
curl -u username:pwd  -i -XDELETE http://localhost:9200/jc_person_record







  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值