1 更新操作
- 1 更新索引(indexName)下某个字段(cloumnName)的值
POST indexName/_update_by_query
{
"query": {
"match_all":{}
},
"script": {
"source": "ctx._source['cloumnName']=1"
}
}
- 2 更新索引(indexName)下某个字段(cloumnName)的值
POST my_index/_update_by_query
{
"script": {
"lang": "painless",
"inline": "ctx._source.new_field_name1= '1111'"
}
}
PUT indexName/_mapping/indexTypeName
{
"properties": {
"new_field_name1": {
"type": "keyword"
},
"new_field_name2": {
"type": "keyword"
},
"HUMIDITY": {
"type": "object",
"enabled": false
}
}
}
2 系统配置
PUT /index_cat/_settings
{ "index" : { "max_result_window" : 500000}}
3 查询
POST index_cat/_update_by_query
{
"query": {
"bool": {
"must": [
{
"match": {
"iscat":2
}
}
]
}
},
"script": {
"source": "ctx._source['iscat']=0"
}
}
- list入参聚合案例 “catid”: [ “001”,“002” ]
GET index_cat/_search
{
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"terms": {
"catid": [
"001","002"
]
}
}
]
}
}
]
}
},
"size": 0,
"aggs": {
"general_agg_key": {
"composite": {
"sources": [
{
"catid": {
"terms": {
"field": "catid"
}
}
},
{
"is_cat": {
"terms": {
"field": "is_cat"
}
}
}
],
"size": 1000000
}
}
}
}
GET index_cat/_search
{
"query": {
"match_all": {}
}
}