1、基础查询
GET trans_deposit/_search
{
//条件查询
"query": {
"bool": {
"must": [
{"term": {
"jYCode": {
"value": "JY202108040004"
}
}}
]
}
}
}
//分组查询
GET trans_deposit/_search
{
"aggs": {
"group_by_cityId":{
"terms": {
"field": "cityId",
"size": 100
}
}
}
}
//查询某个字段是空值 同select * from 表名 where 字段名 is null
GET index/type/_search
{
"query": {
"bool": {
"must_not": {
"exists": {
"field": "字段名"
}
}
}
}
}
//反之,查询字段不为空值的语句
GET index/type/_search
{
"query": {
"bool": {
"must": {
"exists": {
"field": "字段名"
}
}
}
}
}
2、基础修改
POST trans_accessory/_update_by_query
{
"script": {
"source": "ctx._source['accessoryType'] = params.accessoryType",
"params": {
"accessoryType": {
"name" : "产证",
"value" : "property-card"
}
}
},
"query": {
"bool": {
"must": [
{
"term": {
"accessoryType.value": {
"value": "productionCertifi"
}
}
},
{
"terms": {
"jYCode": [
"JY202003040001",
"sub202104210027"
]
}
}
]
}
}
}