ES5.4.1 命令

来源:互联网 发布:游戏租号 软件 编辑:程序博客网 时间:2024/06/06 09:37

1count 命令

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



2删除命令  incDay是字符串类型,格式:2017-10-10

curl -XPOST 'http://10.202.35.201:9200/'$index_name'/'$type_name'/_delete_by_query?pretty' -d '
{
  "query": {
"bool":{
"must":[
{
    "range": {
      "incDay":{
      "lt":"'$severaldayago'"
      }
    }
}
]
}
  }
}'



按照时间类型字段删除数据

按时间删除数据
先查询后删除
timestamp 是时间类型
curl -XGET 'http://10.202.13.143:9200/bdpbiedimidxdept/dept/_search?' -d '
{
"query":{
"bool":{
"must":[
{
"range" : { 
"timestamp" : { "from" : "now-90d", "to" : "now-35d" } }
}
],
"must_not": [ ],
"should":[ ]
}
},
"from":0,
"size":10
}'



curl -XPOST 'http://10.202.13.143:9200/bdpbiedimidxdept/dept/_delete_by_query?pretty' -d '
{
  "query": {
"bool":{
"must":[
   {
"range" : { 
"timestamp" : { "from" : "now-90d", "to" : "now-35d" } }
}
]

}
  }
}'



更新refresh时间间隔
curl -XPUT 'localhost:9200/twitter/_settings?pretty' -H 'Content-Type: application/json' -d'
{
    "index" : {
        "refresh_interval" : "-1"
    }
}’

原创粉丝点击