所有指令需要密码,添加如下代码
-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
Elastic常用指令
最新推荐文章于 2024-07-03 17:33:58 发布