当前位置 : 主页 > 编程语言 > java >

es的增删改查

来源:互联网 收集:自由互联 发布时间:2022-07-04
# 根据索引和条件查找 GET lc_auth_user/_search { "query": { "bool": { "must": [ {"term": { "username.keyword": { "value": "admin" } }}, { "term": { "client_id.keyword": { "value": "39afcf51c44611ecae15fa163e7a6636" } } } ] } } } # 根
# 根据索引和条件查找
GET lc_auth_user/_search
{
"query": {
"bool": {
"must": [
{"term": {
"username.keyword": {
"value": "admin"
}
}},
{
"term": {
"client_id.keyword": {
"value": "39afcf51c44611ecae15fa163e7a6636"
}
}
}
]
}
}
}

# 根据索引查找
GET lc_auth_user/_search
{
"query": {
"bool": {
"must": [
]
}
}
}

# 新增/数据
POST /lc_auth_user/_doc/
{
"id": "2857da45-c1fc-11ec-ae15-fa163e7a6636",
"client_id": "39afcf51c44611ecae15fa163e7a6636",
"username": "admin",
"password": "85627950ec04548186a046c40dd8ecd78deae0e925550e627c7cfb6a0a7791ce",
"display_name": "admin",
"phone_no": "15286372141",
"email": null,
"org_id": null,
"expiry_date": "",
"password_expiry_date": "",
"account_status": 1,
"is_enable": 1,
"is_deleted": 0,
"create_time": "",
"update_time": ""
}

# 更新数据字段
POST /lc_auth_user/_doc/_update_by_query
{
"script": {
"inline": "ctx._source.account_status=params.account_status",
"lang": "painless",
"params": {
"account_status": 1
}
},
"query": {
"term": {
"id.keyword": "2857da45-c1fc-11ec-ae15-fa163e7a6636"
}
}
}

# 删除数据
DELETE /lc_auth_user/_doc/-j93loEBqhhXqkYRI3y1

  


网友评论