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 ...
随机推荐
- 使用yum命令出错:SyntaxError: invalid syntax 由于用户取消而退出
详见: https://blog.csdn.net/qq_24880013/article/details/90731617 必须修改的两个yum配置文件: 因为yum使用python2,因此替换为p ...
- hbuilder离线打包iOS,xcode开发卡在启动页注意点
1.Display Name的名称与manifest.json中的name保持一致. 2.项目文件夹名.contro.xml中的appid.manifest.json中的id一致
- [Luogu] trip
https://www.luogu.org/problemnew/show/T28848#sub #include <iostream> #include <cstdio> u ...
- mac使用brew安装mysql报RROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
使用mac安装mysql安装完后运行 mysql -uroot -p 报了 ERROR 2002 (HY000): Can't connect to local MySQL server throug ...
- The Road to SDN: An Intellectual History of Programmable Networks
文章名称:The Road to SDN: An Intellectual History of Programmable Networks 文章来源:Feamster N , Rexford J , ...
- MySQL安装及基础命令
介绍数据库安装基础命令 linux的下载和安装 mac的下载和安装 windows的下载和安装 介绍: 数据库在开发中占据的位置? 数据库能更简单的使用存储在文件中的数据能更好的解决并发问题,数据统一 ...
- HDU 1024 Max Sum Plus Plus ——(M段区间的最大和)
感觉有点奇怪的是这题明明是n^2的复杂度,n=1e6竟然能过= =.应该是数据水了. dp[i][j]表示前j个数,分成i段,且最后一段的最后一个为a[j]的答案.那么转移式是:dp[i][j] = ...
- MyBatis动态Sql 的使用
Mapper.xml提示: 1:mapper包中新建一个文件:mybatis-3-mapper.dtd 2:在web app libraries/mybatis.jar/org.apache.ibat ...
- redis服务及其配置与应用(window 环境下)
一.redis简介:Redis是一个开源的使用ANSI C语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value数据库,并提供多种语言的API(源自百度百科),个人更喜欢下面的解释:我们 ...
- 【转载】Python tips: 什么是*args和**kwargs?
转自Python tips: 什么是*args和**kwargs? 先来看个例子: def foo(*args, **kwargs): print 'args = ', args print 'kwa ...