前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >elasticsearch索引

elasticsearch索引

作者头像
JQ实验室
发布2022-02-10 14:12:26
3190
发布2022-02-10 14:12:26
举报
文章被收录于专栏:实用技术

查看集群状态 http://127.0.0.1:9200/_cluster/health 返回: {"cluster_name":"elasticsearch","status":"green","timed_out":false,"number_of_nodes":3,"number_of_data_nodes":3, "active_primary_shards":45,"active_shards":90,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":0, "delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0, "task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":100.0} 查询所有索引: http://172.0.0.1:9200/_cat/indices

查看单个索引: http://172.0.0.1:9200/index_name 或者:http://172.0.0.1:9200/_mapping/索引别名 3、创建索引: put请求 http://127.0.0.1:9200/索引名称 body 参数 { "mappings":{ "properties":{ "realname":{ "type":"text", "index":true }, "username":{ "type":"keyword", "index":false } } } } mappings properties 为固定结构 realname username 相当于数据库中的 列 type 为数据类型 index是否支持索引 其中 text keyword 是数据类型 都属于 string类型 但是 keywrod不支持倒排索引 只支持精确查找 创建成功返回消息 {"acknowledged":true,"shards_acknowledged":true,"index":"index_mapping"} 1、 #删除指定索引 # curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-2018.08.09 {"acknowledged":true} 2、#删除多个指定索引,中间用逗号隔开 # curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-2018.08.09,acc-apply-2018.08.10 3、#模糊匹配删除 # curl -XDELETE -u elastic:changeme http://localhost:9200/acc-apply-* {"acknowledged":true} 4、#使用通配符,删除所有的索引 curl -XDELETE http://localhost:9200/_all 或 curl -XDELETE http://localhost:9200/* _all ,* 通配所有的索引 通常不建议使用通配符,误删了后果就很严重了,所有的index都被删除了 禁止通配符为了安全起见,可以在elasticsearch.yml配置文件中设置禁用_all和*通配符 action.destructive_requires_name = true 这样就不能使用_all和*了  5、#获取当前索引 # curl -u elastic:changeme 'localhost:9200/_cat/indices?v'

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-04-26 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
命令行工具
腾讯云命令行工具 TCCLI 是管理腾讯云资源的统一工具。使用腾讯云命令行工具,您可以快速调用腾讯云 API 来管理您的腾讯云资源。此外,您还可以基于腾讯云的命令行工具来做自动化和脚本处理,以更多样的方式进行组合和重用。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档