更新操作 ../1/_update 更新如果和原数据相同,则不需要更新版本
put 或不带update post 都会更新所有数据
elasticsearch 操作数组
PUT /test_index
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 1
}
}
post /test1/_update/1
{
"script": {
"source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }",
"lang": "painless",
"params": {
"tag": "tag2"
}
}
}
POST test/_update/1
{
"script": {
"source": "if (ctx._source.tags.contains(params.tag)) { ctx._source.tags.remove(ctx._source.tags.indexOf(params.tag)) }",
"lang": "painless",
"params": {
"tag": "blue"
}
}
}
get /test1/_search
put /associated_word
{
"settings": {
"number_of_shards": 36,
"number_of_replicas": 2
},
"mappings": {
"properties": {
"onsite_search_word_key": {
"type": "keyword"
},
"onsite_search_word": {
"type": "keyword"
},
"score": {
"type": "float"
}
}
}
}
REST APIs > Document APIs > Update Update API | Elasticsearch Guide [7.15] | Elastic