1、在名为a的索引中新增类型为long的名为deleteTime的字段。
PUT a/_mapping
{
"properties": {
"deleteTime": {
"type": "long"
}
}
}
2、在名为a的索引中新增类型为boolean的名为remind的字段。
PUT a/_mapping
{
"properties": {
"remind": {
"type": "boolean"
}
}
}
3、在名为a的索引中设置名为remind的字段默认值为true。
POST a/_update_by_query
{
"query": {
"bool": {
"must_not": [
{
"exists": {
"field": "remind"
}
}
]
}
},
"script": {
"source": "ctx._source['remind'] = true"
}
}
4.搜索名为a的索引下所有数据。
GET a/_search
{
"query": {
"match_all": {}
}
}