当前位置:   article > 正文

elasticsearch之UpdateByQueryRequest_esupdatebyquery

esupdatebyquery

searchSourceBuilder.query(QueryBuilders.matchQuery(“_id”, “SvjgP24BndtcmnpzbiuL”));

searchSourceBuilder.size(2);

searchRequest.source(searchSourceBuilder);

SearchResponse searchResponse = highLevelClient.search(searchRequest, RequestOptions.DEFAULT);

SearchHit[] searchHits = searchResponse.getHits().getHits();

for(SearchHit s:searchHits){

String docId = s.getId();

UpdateRequest request = new UpdateRequest(“sub_bank1031”,“sub_bank”,docId);

request.doc(“{“aliasName”:“中国农业发展银行林州市支行444”,“bankType”:“ADB”,“bankTypeName”:“中国农业发展银行”,“cityId”:“410500”,“cityName”:“安阳市”,“createTime”:1515719190000,“createUser”:“system”,“id”:“000238a326b044e9ae10cfe4298f4c44”,“isEnabled”:“1”,“name”:“中国农业发展银行林州市支行”,“provinceId”:“410000”,“provinceName”:“河南省”,“unionNumber”:“203496100010”}”, XContentType.JSON);

UpdateResponse resp = highLevelClient.update(request, RequestOptions.DEFAULT);

println(resp.getResul

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/660789
推荐阅读
相关标签
  

闽ICP备14008679号