ES:document的全量替换、强制创建以及图解lazy delete机制
2018-09-21 16:47
197 查看
1、document的全量替换
(1)语法与创建文档是一样的,如果document id不存在,那么就是创建;如果document id已经存在,那么就是全量替换操作,替换document的json串内容
PUT /test_index/test_type/4 { "test_fied":"test test1111111" }
(2)document是不可变的,如果要修改document的内容,第一种方式就是全量替换,直接对document重新建立索引,替换里面所有的内容
(3)es会将老的document标记为deleted,然后新增我们给定的一个document,当我们创建越来越多的document的时候,es会在适当的时机在后台自动删除标记为deleted的document
2、document的强制创建
(1)创建文档与全量替换的语法是一样的,有时我们只是想新建文档,不想替换文档,如果强制进行创建呢?
PUT /test_index/test_type/4/_create { "test_fied":"test " }
{ "error": { "root_cause": [ { "type": "version_conflict_engine_exception", "reason": "[test_type][4]: version conflict, document already exists (current version [4])", "index_uuid": "oT8hUqMcTXOB5Fx-rfWlzw", "shard": "2", "index": "test_index" } ], "type": "version_conflict_engine_exception", "reason": "[test_type][4]: version conflict, document already exists (current version [4])", "index_uuid": "oT8hUqMcTXOB5Fx-rfWlzw", "shard": "2", "index": "test_index" }, "status": 409 }
3、document的删除
DELETE /test_index/test_type/4
(2)不会直接物理删除,只会将其标记为deleted,当数据越来越多的时候,在后台自动删除
相关文章推荐
- 015,elasticsearch--[L17]--document的全量替换、强制创建以及图解lazy delete机制
- ElasticSarch7:document的全量替换、强制创建以及图解lazy delete机制
- 第六篇 elasticsearch中的document全量替换、强制创建以及删除机制
- elasticsearch核心知识--14.初步解析document的核心元数据以及图解剖析index创建反例
- shard&replica机制再次梳理以及单node环境中创建index图解
- 009,elasticsearch--[L10]--shard&replica机制再次梳理以及单node环境中创建index图解
- 初步解析document的核心元数据以及图解剖析index创建反例
- Linux下iptables的工作机制图解以及在NAT的应用
- Spring入门之创建Bean的时间以及lazy-init属性
- C++类的静态成员函数在多线程的工作机制以及运行过程中强制结束线程实验
- IOS在Document目录下创建文件夹、保存、读取、以及删除文件
- 在ios中的Document中创建多级文件夹以及文件
- 对session对象在web开发中的创建以及sessionId生成并返回客户端的运行机制.
- tensorflow学习(4):保存模型Saver.save()的参数命名机制以及restore并创建手写字体识别引擎
- 对session对象在web开发中的创建以及sessionId生成并返回客户端的运行机制.
- elasticsearch核心知识---53.图解剖析document写入原理以及Segement的合并
- Win32中窗口的创建和消息机制以及MFC对Win32的封装简介
- oracle(1)验证机制以及用户创建、修改
- 在ios中的Document中创建多级文件夹以及文件
- elasticsearch核心知识--9.shard&replica机制再次梳理以及单node环境中创建index图解