查看索引中某个文档
GET 索引名/_doc/id
查询条件
POST 索引名/_search
{
"from": 0, 分页
"size": 20,
"sort": [
{
"FIELD": {//排序
"order": "desc"
}
}
],
"_source": {
"includes": "{field}",
"excludes": "{field}"
},
"query": {
"bool": {
"must": [
{
"term": {
"字段": {
"value": "字段值"
}
}
}
...
]
}
}
}
统计符合条件总数
POST 索引名/_count
{
"query": {
"bool": {
"must": [
{
"term": {
"字段": {
"value": "字段值"
}
}
},
{
"match": {
"FIELD": "TEXT"
}
},
{
"range": {
"gmtCreate": {
"from": null,
"to": "2021-01-01 00:00:00",
"include_lower": true,
"include_upper": true,
"format": "yyyy-MM-dd HH:mm:ss",
"boost": 1.0
}
}
}
...
]
}
}
}
修改数据
POST 索引名/_update_by_query
{
"query": {
"bool": {
"must": [
{
"term": {
"字段": {
"value": "字段值"
}
}
}
...
]
}
},
"script": {
"source": "ctx._source['f1'] = params['fv1'];ctx._source['f2'] = params['fv2']",
"params": {
"fv1": 12,
"fv2":"dddd"
}
}
}
删除数据
POST 索引名/_delete_by_query
{
"query": {
"bool": {
"must": [
{
"term": {
"字段": {
"value": "字段值"
}
}
}
...
]
}
}
}



