ES基本语句

# 根据条件更新字段
POST bss_lst_clue_index/_update_by_query
{
  "query": {
    "match": {
      "clueId": "11838"
    }
  },
  "script": {
    "source": "ctx._source['recycleDate'] = params['recycleDate']",
    "params": {
      "recycleDate": 1723132800000
    }
  }
}


# 线索基本信息查询
GET bss_lst_clue_index/_search
{
    "query": {
        "bool": {
            "must": [{
                "term": {
                    "bdCode": "GSQD25092"
                }
            },
            {
                "term": {
                    "type": 2
                }
            },
            {
                "term": {
                    "status": 3
                }
            }],
            "filter": [{
                "range": {
                    "recycleDate": {
                        "lte": 1723219200000
                    }
                }
            }]
        }
    },
    "track_total_hits": true
}
 
# 两种方式都可行
GET bss_lst_clue_index/_search
{
    "query": {
        "constant_score" : {
            "filter" : {
                 "bool" : {
                    "must" : [
                        { "term" : { "bdCode" : "GSZN25772" } },
                        { "term" : { "type" : 2 } },
                        { "term" : { "status" : 3 } }
                    ]
                }
            }
        }
    }
}

# 线索统计记录数, 返回结果字段解释
# "count": 表示匹配查询条件的文档总数。
# "_shards": 包含有关搜索分片的信息。
# "total": 参与搜索的分片总数。
# "successful": 成功执行搜索的分片数。
# "skipped": 跳过的分片数,通常是因为它们不可用。
# "failed": 执行搜索失败的分片数。
 
GET bss_lst_clue_index/_count
{
    "query": {
        "bool": {
            "must": [{
                "term": {
                    "bdCode": "GSQD1209"
                }
            },
            {
                "term": {
                    "type": 2
                }
            },
            {
                "term": {
                    "status": 3
                }
            }],
            "filter": [{
                "range": {
                    "recycleDate": {
                        "lte": 1723219200000
                    }
                }
            }]
        }
    }
}
 
 
# 删除字段_update/{"_id" : "11838"}
POST bss_lst_clue_index/_update/11838
{
  "script": {
    "source": "ctx._source.remove(\"column\")",
    "lang": "painless"
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值