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 ...
随机推荐
- Nginx的TCP/UDP调度器
安装nginx [root@proxy ~]# yum –y install gcc pcre-devel openssl-devel //安装依赖包 [root@proxy ~]# .tar.gz ...
- 【转】css样式的书写顺序及原理——很重要!
记得刚开始学习前端的时候,每次写css样式都是用到什么就在样式表后添加什么,完全没有考虑到样式属性的书写顺序对网页加载代码的影响.后来逐渐才知道正确的样式顺序不仅易于查看,并且也属于css样式优化的一 ...
- learning armbian steps(9) ----- armbian 源码分析(四)
在上一节的分析当中,我们知道是通过对话框来选择到底编译的是哪块板子,基于什么样的配置. 接下来我们来拿一个实例来分析一下具体的案例,我们会选中如下所示的版本 iotx-3 AM335X 1Gb SoC ...
- spring boot+idea实现程序热部署
pring为开发者提供了一个名为spring-boot-devtools的模块来使Spring Boot应用支持热部署,提高开发者的开发效率,无需手动重启Spring Boot应用. devtools ...
- css让文字,字母折行
加上如下的CSS设置,就是设定好宽度width,然后设置合适的word-wrap和word-break属性: ul li{ width: 100px; word-wrap: break-word; w ...
- 洛谷——P2058 海港
题目传送 由于于题目保证输入的ti是递增的,所以发现当我们统计完一艘船的答案后,这个答案多少会对下一艘船的答案有贡献.同时还发现如果对每个艘船都记录他的乘客在整个数据出现的所有国籍中相应出现的次数,在 ...
- MySQL原理解析
逻辑架构 MySQL逻辑架构整体分为三层: 客户端层,连接处理.授权认证.安全等功能均在这一层处理. 核心服务层,包括查询解析.分析.优化.缓存.内置函数(比如:时间.数学.加密等函数).所有的跨存储 ...
- MyBatis动态Sql 的使用
Mapper.xml提示: 1:mapper包中新建一个文件:mybatis-3-mapper.dtd 2:在web app libraries/mybatis.jar/org.apache.ibat ...
- oracle函数mysql替代方案
=====1.日期相关===//获取当前日期在本周的周一select subdate(now(),date_format(now(),'%w')-1);//获取当前日期在本周的周日 select su ...
- YOLOv3的Darknet在OpenCV3.4.1(bug)下编译出错填坑
刚配置完环境 https://www.cnblogs.com/clemente/p/11029117.html 能正常跑原版 darknet ,但是跑了一下别人修改的版本出现了错误 查Google之后 ...