当前位置: 代码迷 >> 综合 >> elasticsearch 文档操作(updating)
  详细解决方案

elasticsearch 文档操作(updating)

热度:89   发布时间:2024-01-05 10:22:01.0

更新操作 ../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/_searchput /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

  相关解决方案