写入es有两种,一种是create请求,覆盖操作。一种update局部更新操作。本次讨论各种情况es写入的版本控制问题,以及flink1.6.x与es6.x的小插曲
1:测试不控制版本号的create覆盖操作
Requests.indexRequest() .index("test") .type("_doc") .id(inputjson.getString("serialid")) .source(JsonUtil.convert2Map(inputjson.toString().trim()));
es上数据
改变数据再写一次
可见不控制时每次写入操作都会是version自动加1: 此时与——score 里 version字段大小无关
2:对version进行指定写入该条version=2 的数据
写入
jsons.put("serialid","testcreate") ; jsons.put("value1","1") ; jsons.put("version","3") ;
Requests.indexRequest() .index(