elasticsearch 常用查询 + 删除索引 + 集群状态诊断
1.多条件查询
curl -X POST \
http://10.0.0.42:9200/addressbook_user/_search \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{
"query": {
"bool": {
"must": [
{
"term": {
"orgId": {
"value": "0db8574bb127466ab03be74ac74235da",
"boost":
}
}
},
{
"term": {
"userId": {
"value": "fa3058d8398a455304a3b8e439e29fdd",
"boost":
}
}
}
],
"adjust_pure_negative": true,
"boost":
}
}
}' curl -X POST \
http://10.0.0.35:9200/addressbook_user/_search \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{
"query": {
"match": {
"userId": "8ad37acb7860e3729c964699287de46e"
}
}
}'
2.删除索引
curl -XDELETE http://10.0.0.7:9200/wxqyh180867134-2019.09.16
curl -XGET '10.0.0.205:9200/_cat/indices?v'
curl -XDELETE '10.0.0.205:9200/*2020.01.21'
---------------------------------------------------------------------------------------------------------
1.与查询
curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"query": {
"bool": {
"must": [
{ "match": { "address": "mill" } },
{ "match": { "address": "lane" } }
]
}
}
}'
curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"query": {
"bool": {
"should": [
{ "match": { "address": "mill" } },
{ "match": { "address": "lane" } }
]
}
}
}'
2.非查询
curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"query": {
"bool": {
"must_not": [
{ "match": { "address": "mill" } },
{ "match": { "address": "lane" } }
]
}
}
}'
-------------------------------------------------------------------------------------------------------
1.查询脚本
#!/bin/bash
source ./vars_config.conf
#USAGE EXAMPLES #QUERY INDEICES
function query_index(){
echo "--------------------indices-----------------------"
curl -XGET "$ES_URL/_cat/indices?v&pretty"
}
#QUERY NODES
function query_nodes(){
echo "--------------------nodes-----------------------"
curl -XGET "http://$ES_URL/_cat/nodes?v"
}
#QUERY CLUSTER
function query_cluster(){
echo "--------------------cluster mem - cpu -----------------------"
curl -XGET "http://$ES_URL/_cluster/stats?pretty"
echo "--------------------cluster-----------------------"
curl -XGET "http://$ES_URL/_cat/nodes/?v&pretty"
}
#QUERY ALLOCATION
function query_allocation(){
echo "--------------------allocation-----------------------"
curl -XGET "http://$ES_URL/_cat/allocation?v"
}
#QUERY VERSION
function query_version(){
echo "--------------------version-----------------------"
curl -XGET "http://$ES_URL/?pretty"
}
#QUERY HELP
function query_help(){
echo "--------------------help-----------------------"
echo "USAGE EXAMPLE: sh $0 help"
echo "parameters: <indices>,<nodes>,<clutser>,<allocation>,<version>,<help>,<all>"
}
if [[ $# -eq ]];then
query_help
fi
case $ in
indices)
# echo "--------------------indices-----------------------"
query_index;; nodes)
query_nodes;; cluster)
query_cluster;; allocation)
query_allocation;; version)
query_version;; help)
query_help;; all)
query_nodes
query_index
query_allocation
query_cluster
;;
esac
[root@host164 elasticsearch]# cat vars_config.conf
ES_URL="192.168.1.49:9200"
elasticsearch 常用查询 + 删除索引 + 集群状态诊断的更多相关文章
- java操作elasticsearch实现查询删除和查询所有
后期博客本人都只给出代码,具体的说明在代码中也有注释. 1.查询删除 //查询删除:将查询到的数据进行删除 @Test public void test8() throws UnknownHostEx ...
- Elasticsearch日志之删除索引
1.查询索引 [root@ecs-- elasticsearch]# curl -XGET http://localhost:9200/* {,,},},},,,},},},,,},},},,,},} ...
- Elasticsearch之curl删除索引库
关于curl创建索引库的介绍,请移步 Elasticsearch之curl创建索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://1 ...
- ElasticSearch 常用查询语句
为了演示不同类型的 ElasticSearch 的查询,我们将使用书文档信息的集合(有以下字段:title(标题), authors(作者), summary(摘要), publish_date(发布 ...
- ElasticSearch常用查询命令-kibana中使用
目录 初学ES 只创建索引(表) 1. 创建 2.创建好后查看索引结构 添加文档(数据) 查看文档(数据) 修改文档数据(数据update) put方式修改 post方式修改 删除文档&索引 ...
- Elasticsearch之curl删除
扩展下, Elasticsearch之curl删除索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XDELETE 'http://192.168.80.2 ...
- Elasticsearch 使用集群 - 删除索引
章节 Elasticsearch 基本概念 Elasticsearch 安装 Elasticsearch 使用集群 Elasticsearch 健康检查 Elasticsearch 列出索引 Elas ...
- es故障节点恢复后加入集群导致删除索引重新出现
es的每个shard下的文件都可以看做一个完整的lucene文件,shard数据目录下的segment文件包含了索引的分片数量,副本数量.es shard可以恢复,就是因为每个shard都包含了一份数 ...
- elasticsearch(四) 之 elasticsearch常用的一些集群命令
目录 elasticsearch常用的一些集群命令 查看集群健康状态 查看集群的节点列表 查看所有的索引 删除索引 查询索引的某个文档内容 更新文档 删除文档 自动创建索引 定时删除索引 elasti ...
随机推荐
- 218多校第九场 HDU 6424 (数学)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6424 题意:定义f(A) = log log log log …. (A个log) n ,g[A,B, ...
- BZOJ 3514: Codechef MARCH14 GERALD07加强版 (LCT维护最大生成树+主席树)
题意 给出nnn个点,mmm条边.多次询问,求编号在[l,r][l,r][l,r]内的边形成的联通块的数量,强制在线. 分析 LCTLCTLCT维护动态最大生成树,先将每条边依次加进去,若形成环就断掉 ...
- 【Android Studio】 加载so文件异常
AS无法加载so包异常 android studio导入so包异常:Couldn't load DeviceAPI from loader dalvik.system.PathClassLoader[ ...
- python基于opencv实现人脸定位
import cv2 # 读取图片 img = cv2.imread("image.jpg") # 加载模型,模型可以从https://github.com/opencv/open ...
- deepin Linux 日常命令、插件、方法等汇总【更新中】
查看系统编码: dawn@dawn-PC:~$ locale LANG=zh_CN.UTF- LANGUAGE=zh_CN LC_CTYPE="zh_CN.UTF-8" LC_NU ...
- C++cctype软件包函数摆脱,ASCII码!
对于字符,你是否还在用ASCII码? 下面是C++的函数库,摆脱ASCI码! 1.isalnum(): 判断是否为数字和字母 2.isalpha(): 判断是否是字母 3.iscntrl(): 判断是 ...
- shell [ ] 和 [[ ]] 区别
[参考文章]:shell if [[ ]]和[ ]区别 || && [参考文章]:Shell test 命令 1. [ ] 和 test test 等同于 [ ] 可用于判断某个条件 ...
- 脚本:将git项目下载到本地并启动
大致思路:从git上clone源代码到本地:使用mvn package将源代码达成war/jar包:将打好的包放到tomcatpath/webapps/下:到tomcatpath/bin/下执行res ...
- Beta冲刺(1/5)
队名:new game 组长博客:戳 作业博客:戳 组员情况 鲍子涵(队长) 过去两天完成了哪些任务 验收游戏素材 学习Unity 2D Animation系统 接下来的计划 制作游戏需要的人物动画 ...
- ios-tableViewcell展开与收缩动画处理
[前言] 在使用华尔街见闻 app 时,看到它的 tableVeiw 上的 cell 具有很好的展开与收缩功能.于是自己想了一下实现,感觉应该挺简单的,于是心痒痒写个 demo 实现一波.华尔街见闻 ...