ES 常用查询语句
配置查询
_cluster/settings
_cluster/settings?flat_settings
_cluster/settings?include_defaults
_cluster/settings?include_defaults&flat_settings
/_stats/fielddata
/_stats/fielddata?fields=*
/_nodes/stats/indices/fielddata?fields=*
/_nodes/stats/indices/fielddata?level=indices&fields=*
indices.breaker.fielddata.limit fielddata级别限制,默认为堆的60%
indices.breaker.request.limit request级别请求限制,默认为堆的40%
indices.breaker.total.limit 保证上面两者组合起来的限制,默认堆的70%
indices.fielddata.cache.size
索引查询
指定显示哪些列
GET /_cat/indices/twitter?pri&v&h=health,index,pri,rep,docs.count,mt
每一个索引使用了多少内存
GET /_cat/indices?v&h=i,tm&s=tm:desc
哪些索引状态是yellow
GET /_cat/indices?v&health=yellow
哪个索引文件最多
GET /_cat/indices?v&s=docs.count:desc
每个节点的分片数和磁盘使用情况
GET /_cat/allocation?v
fielddata 显示每个节点字段所占的堆空间
GET /_cat/fielddata?v
GET /_cat/fielddata?v&fields=name,addr
recovery 显示索引恢复情况
GET /_cat/recovery?v
thread_pool 显示每个节点线程运行情况。
GET /_cat/thread_pool?v
GET /_cat/thread_pool/bulk?v
GET /_cat/thread_pool/bulk?v&h=id,name,active,rejected,completed
shards 显示每个索引各个分片的情况
GET /_cat/shards?v
GET /_cat/shards/myindex?v
GET _cat/shards?h=index,shard,prirep,state,unassigned.reason
segments 显示每个segment的情况
GET /_cat/segments?v
GET /_cat/segments/myindex?v
优化设置
gateway.recover_after_data_nodes: 3
gateway.recover_after_time: 5m
gateway.expected_data_nodes: 3
system.service
cat /usr/lib/systemd/system/es.service
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
User=es
Group=es
ExecStart=/usr/local/elasticsearch-7.8.1/bin/elasticsearch
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=2s
StandardOutput=journal
StandardError=inherit
# Specifies the maximum file descriptor number that can be opened by this process
LimitNOFILE=65536
# Specifies the maximum number of processes
LimitNPROC=4096
# Specifies the maximum number of bytes of memory that may be locked into RAM
# Set to "infinity" if you use the 'bootstrap.memory_lock: true' option
# in elasticsearch.yml and 'MAX_LOCKED_MEMORY=unlimited' in /etc/sysconfig/elasticsearch
#LimitMEMLOCK=infinity
LimitMEMLOCK=infinity
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop the Java process
KillSignal=SIGTERM
# Java process is never killed
SendSIGKILL=no
# When a JVM receives a SIGTERM signal it exits with code 143
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now es
螃蟹在剥我的壳,笔记本在写我,漫天的我落在枫叶上雪花上,而你在想我。
--章怀柔
分类:
ElasticSeacrh
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-08-11 ES elasticsearch 各种查询
2021-08-11 ES elasticsearch 各种聚合
2021-08-11 ES elasticsearch 聚合统计