es常用命令

按条件查询,将查询结果存储在文件中,size不能超过10000

curl -XPOST http://ipaddress:9200/incbdpiforder/orders/_search?pretty -d '

{
"query": {
"bool": {
"must": [
{
"term": {
"incDay": "20170502"
}
}
,
{
"term": {
"cityCode": "A440300000"
}
}
],
"must_not": [ ],
"should": [ ]
}
},
"from": 0,
"size": 600,
"sort": [ ],
"aggs": { }

}'>aa.txt

 

 

删除索引

curl -XDELETE http://10.202.8.122:9200/index?pretty

 

查看mapping

curl -XGET http://10.202.34.201:9200/inc/_mapping/orders?pretty

 

删除记录

curl -XDELETE  'http://10.202.34.201:9200/inc/history/_query?pretty' -d '

{"query": {

  •   "bool": {
    • "must": 
      •      {
        • "match_all": { }
             }
      •   }
      • }
      • }'

 

 

 

 

列出所有索引:

curl -XGET http://10.202.8.122:9200/_cat/indices?v

  • 查看索引状态
  •  

curl -XGET http://10.202.8.122:9200/_cat/indices?v|grep inc

 

curl -XGET http://10.202.8.122:9200/_cat/indices?v|grep inc

集群健康状况

curl -XGET http://10.202.8.122:9200/_cluster/health?pretty

 

查看线程池大小

curl -XGET "http://10.202.34.201:9200/_nodes/thread_pool/"

修改线程池

  1. curl -XPUT '10.202.8.122:9200/_cluster/settings' -d '{  
  2.     "transient": {  
  3.         "threadpool.bulk.type": "fixed",  
  4.         "threadpool.bulk.size": 8,  
  5.         "threadpool.bulk.queue_size": 200  
  6.     }  
  7. }'  

     

 

查看前5sES数据

 

aa=`curl -XGET 'http://10.202.77.206:9200/incbdpiforder/_count' -d'
{
"query":{
"range": {
"timestamp":{
"gt": "now-5m",
"lt": "now"
}
}
}
}'`

切分结果,获取前5分钟写入ES的数据量
 if [ $? -eq 0 ] ; then
echo $aa
#out=`echo $aa | awk -F ',' '{print $1;}' | awk -F ':'  '{print $2;}'`
#echo $out
out1=` $aa | awk -F '[,:]' '{print $2;}'`
echo $out1
fi
~   

添加字段

POST index/type/_update_by_query
{
    "script":{
        "lang":"painless",
        "inline":"if (ctx._source.xx == null) {ctx._source.xx= 1.0}"
    }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值