es常用操作
1.查看所有索引
_cat/indices?v
2.删除索引
DELETE my_index
3.查询缓存
curl -XGET http://127.0.0.1:9200/my_index/_search?request_cache=true' -d'
4.开启缓存
#配置文件中添加
index.request.cache.enable: true
5.清空缓存
curl -XPOST 'localhost:9200/kimchy,elasticsearch/_cache/clear?request_cache=true'
6.修改index.max_result_window
curl -XPUT http://127.0.0.1:9200/_all/_settings -d '{ "index.max_result_window" :"1000000"}'
7.设置磁盘告警线
curl -XPUT "http://localhost:9200/_cluster/settings" -H 'Content-Type: application/json' -d'
{
"transient": {
"cluster.routing.allocation.disk.watermark.low": "100gb",
"cluster.routing.allocation.disk.watermark.high": "50gb",
"cluster.routing.allocation.disk.watermark.flood_stage": "10gb",
"cluster.info.update.interval": "1m"
}
}'
8.查看文件句柄数量
curl -XGET http://127.0.0.1:9200/_nodes/stats/process?pretty
9.修改索引副本个数
curl -XPUT "http://localhost:9200/my_index/_settings" -H 'Content-Type: application/json' -d'
{
"number_of_replicas": 2
}'
10.修改 refresh 时间
curl -XPUT "http://localhost:9200/index/_settings" -H 'Content-Type: application/json' -d'
{
"refresh_interval”: “10s" }'
11开启慢日志查询
curl -XPUT "http://localhost:9200/index/_settings" -H 'Content-Type: application/json' -d'
{
"index.search.slowlog.threshold.query.warn" : "10s",
"index.search.slowlog.threshold.fetch.debug": "500ms",
"index.indexing.slowlog.threshold.index.info": "5s" }'
集群操作
1.查看集群健康状况
curl -XGET "http://localhost:9200/_cat/health?v"
2.查看集群各节点内存使用情况
curl -XGET "http://localhost:9200/_cat/nodes?v&h=name,port,sm"
3.查看集群节点
curl -XGET "http://localhost:9200/_cat/nodes?v"
4.查看文档数量
curl -XGET "http://localhost:9200/_cat/count?v"
5.查看集群索引
只显示状态为黄色的
curl -XGET "http://localhost:9200/_cat/indices?v&health=yellow"
根据文档降序排列
curl -XGET "http://localhost:9200/_cat/indices?v&s=docs.count:desc"
显示每个索引占用的内存
curl -XGET "http://localhost:9200/_cat/indices?v&h=i,tm&s=tm:desc"
获取每个索引所占用的磁盘空间,按照逆序排列
curl -XGET "http://localhost:9200/_cat/indices?v&h=i,store.size&s=store.size:desc"
6.获取集群的setting
curl -XGET "http://localhost:9200/_cluster/settings"
7.查看集群所在磁盘的分配状况
curl -XGET "http://localhost:9200/_cat/allocation?v"
ES 索引管理
1.创建索引
PUT /xmc_index?pretty
2.添加文档到索引
PUT /xmc_indexa/_doc/1?pretty
{ "name":"xmc"
"phone":"12312312"
}
3.创建索引,设置索引分片数
PUT twitter
{
"settings":{
"index" :{
"number_of_shards":3,
"number_of_replicas":2
} } }
4.创建mapping映射
PUT xmc_indexa
{
"settings":{
"index":{
"number_of_shards":,
"number_of_replicas":
}
},
"mappings":{
"mytype":{
"properties":{
"name":{"type":"text"},
"phone":{"type": "long"}
}
}
}
}
#判断索引是否存在
HEAD xmc_indexa
参考
https://blog.csdn.net/ZYC88888/article/details/91463253
https://www.cnblogs.com/leeSmall/p/9195782.html
https://blog.csdn.net/ifenggege/article/details/86103918 es 查询
es常用操作的更多相关文章
- ES常用操作备忘
格式:<REST Verb>/<Index>/<Type>/<ID> 集群健康:curl -u lases:1fw@2soc#3vpn -XGET 'l ...
- Elasticsearch(ES)API 增删查改常用操作
常用操作 查询所有数据 POST http://192.168.97.173:27009/logstash_test_2018/doc/_search { "query": { & ...
- 【三】用Markdown写blog的常用操作
本系列有五篇:分别是 [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面 [二]jekyll 的使用 :主要是jekyll的配置 [三]Markdown+ ...
- php模拟数据库常用操作效果
test.php <?php header("Content-type:text/html;charset='utf8'"); error_reporting(E_ALL); ...
- Mac OS X常用操作入门指南
前两天入手一个Macbook air,在装软件过程中摸索了一些基本操作,现就常用操作进行总结, 1关于触控板: 按下(不区分左右) =鼠标左键 control+按下 ...
- mysql常用操作语句
mysql常用操作语句 1.mysql -u root -p 2.mysql -h localhost -u root -p database_name 2.列出数据库: 1.show datab ...
- nodejs配置及cmd常用操作
一.cmd常用操作 1.返回根目录cd\ 2.返回上层目录cd .. 3.查找当前目录下的所有文件dir 4.查找下层目录cd window 二.nodejs配置 Node.js安装包及源码下载地址为 ...
- Oracle常用操作——创建表空间、临时表空间、创建表分区、创建索引、锁表处理
摘要:Oracle数据库的库表常用操作:创建与添加表空间.临时表空间.创建表分区.创建索引.锁表处理 1.表空间 ■ 详细查看表空间使用状况,包括总大小,使用空间,使用率,剩余空间 --详细查看表空 ...
- python 异常处理、文件常用操作
异常处理 http://www.jb51.net/article/95033.htm 文件常用操作 http://www.jb51.net/article/92946.htm
随机推荐
- 第02组 Alpha冲刺(1/4)
队名:十一个憨批 组长博客 作业博客 组长黄智 过去两天完成的任务:进行组员分工 GitHub签入记录 接下来的计划:构思游戏实现 还剩下哪些任务:敲代码 燃尽图 遇到的困难:任务分配的不及时,导致很 ...
- 第09组 Alpha冲刺(1/6)
队名:观光队 组长博客 作业博客 组员实践情况 王耀鑫 过去两天完成了哪些任务 文字/口头描述 完成服务器连接数据库部分代码 展示GitHub当日代码/文档签入记录 接下来的计划 与服务器连接,配合前 ...
- 转载:关于思科交换机、路由器如何关闭telnet 开启ssh服务
等保测评要求: 必须关闭telnet服务,开启ssh服务 即用ssh方式登录网络设备,而不允许用telnet. 输入密码.en 再次输入密码.sh run 这些常规动作就不再赘述. 1.关闭telne ...
- HDU 6212 Zuma
Zuma 这个题没有素质!它卡常! 我发现网上很多人的题解都写得很奇怪,也不好确定正确性,所以我借这篇题解表达一下愚见 定义$ dp[i][j][0...4]$表示 0:消完了 1:还剩1个0 2:还 ...
- 年轻人的第一个自定义 Spring Boot Starter!
陆陆续续,零零散散,栈长已经写了几十篇 Spring Boot 系列文章了,其中有介绍到 Spring Boot Starters 启动器,使用的.介绍的都是第三方的 Starters ,那如何开发一 ...
- [Beta]Scrum Meeting#7
github 本次会议项目由PM召开,时间为5月12日晚上10点45分 时长15分钟 任务表格 人员 昨日工作 下一步工作 木鬼 撰写博客整理文档 撰写博客整理文档 swoip 为适应新功能调整布局 ...
- 声源定位之3精读《The Generalized Correlation Method for Estimation of Time Delay》
2.2.1 标题(2019年9月5日) 估计时间差的广义互相关方法 互相关可以表示两个信号的相似程度. 计算:两个信号循环移位相乘再相加,得到的一组互相关值. 相关函数: 何为广义?通用的框架,可以设 ...
- DICOM worklist工作原理
一.关于Worklist 在RIS与PACS的系统集成中.Wordlist的连接为其主要工作之一.Wordlist成像设备工作列表,它是DICOM协议中众多服务类别中的一个.它的功能是实现设备操作台与 ...
- Spring Cloud Zuul 概览
什么是API网关 网关这个词其实是一个硬件概念.因为按照定义,网络网关出现在网络的边缘,所以防火墙和代理服务器等相关功能 往往与之集成在一起.在家庭网络 和小型企业中,宽带路由器通常充当网络网关.它将 ...
- [zhuan]SQLSERVER 数据库性能的基本
SQLSERVER 数据库性能的基本 很久没有写文章了,在系统正式上线之前,DBA一般都要测试一下服务器的性能 比如你有很多的服务器,有些做web服务器,有些做缓存服务器,有些做文件服务器,有些做数据 ...