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"

最新文章

  1. Objective-C runtime初识
  2. C#多线程之基础篇2
  3. Linux 入门之修改主机名
  4. ImportError: cannot import name &#39;_imagingtk&#39;
  5. [原创]html5游戏_贪吃蛇
  6. smarty访问数组中的数据,如果是关联数组直接用点.
  7. java报表工具FineReport的SQL编辑框的语法简介
  8. mysql找回密码
  9. vs2012 + cocos2d-x 2.1.5 + win7开发环境搭建步骤
  10. 驾照理论模拟考试系统Android源码下载
  11. uboot中的mmc命令
  12. 简单干净的C# MVC设计案例:BrothersDropdownList()
  13. Servlet程序开发-- Servlet生命周期
  14. POJ 1848 Tree 树形DP
  15. ubuntu 创建文件夹和删除文件
  16. 云服务器 ECS &gt; 建站教程 &gt; 部署 LAMP (CentOS 7.2 ,Apache版本:2.4.23, Mysql 版本:5.7.17 , Php版本:7.0.12)
  17. Oracle 数据备份与恢复
  18. [转帖]git、github、gitlab之间的关系
  19. linux command wrap
  20. python运算符号

热门文章

  1. centos6.5解压及压缩zip压缩包
  2. HDU&ndash;5988-Coding Contest(最小费用最大流变形)
  3. shell之列表的定义与循环
  4. 【Eureka】 作为服务注册中心,Eureka比Zookeeper好在哪里
  5. Leetcode题目70.爬楼梯(动态规划+递归-简单)
  6. H5-Mui框架——修改mui.confirm样式
  7. LightGBM新特性总结
  8. 动态绑定v-model
  9. Ubuntu16.04.3安装并配置samba方法
  10. backupAgent节点