【发布时间】:2021-08-08 05:05:48
【问题描述】:
Updatequery.builder 只有 withscript(string script) 函数发送脚本源,如果存储脚本如何发送脚本id? .我正在使用弹簧数据弹性搜索 4.1。谢谢
编辑以显示 Spring data elasticsearch 4.2.1 的错误
Map
UpdateQuery updateQuery = UpdateQuery.builder(Query.findAll()).withScriptType(ScriptType.STORED) .withScriptName("updateScript01").withParams(params).build(); this.elasticsearchRestTemplate(updateQuery,IndexCoordniates.of("sampleIndex1"));
例外: 原因:org.elasticsearch.action.ActionRequestValidationException:验证失败:1:缺少id;2:缺少脚本或文档;在 org.elasticsearch.action.ValidateActions.addValidationError(ValidateActions.java:26) 在 org.elasticsearch.action.update.UpdateRequest.validate(UpdateRequest.java:206)
在 kibana 的 elasticsearch 中存储的脚本: POST _scripts/updateScript01 { “脚本”: { "lang": "无痛", “来源”:“ctx._source.message = params.message;” } }
【问题讨论】:
标签: elasticsearch spring-data-elasticsearch