I use ElasticsearchOperations
directories its the List Directory
String scriptText = "if (ctx._source.businessPartnerParams != null) { " +
"ctx._source.businessPartnerParams.bpName = 'test 3 ' " +
"}";
HashMap<String, Object> params = new HashMap<>();
params.put("directories", directories);
UpdateQuery updateQuery = UpdateQuery.builder(Query.findAll())
.withScriptType(INLINE)
.withLang("painless")
.withScript(scriptText)
.withParams(params)
.build();
ByQueryResponse byQueryResponse = operations.updateByQuery(updateQuery,
IndexCoordinates.of(RELEVANT_INDEX_NAME));
and in kibana its view
POST /partners-rd-partners-partners-1/_update_by_query?refresh=false
{
"query": {
"wrapper": {
"query": "eyJtYXRjaF9hbGwiOnt9fQ=="
}
},
"script": {
"params": {
"directories": "[Directory(id=DirectedTypeBUR001, code=BUR001, description=Имеет контактное лицо, type=DirectedType, value=null), Directory(id=DirectedTypeBUR002, code=BUR002, description=Имеет контактного партнера, type=DirectedType, value=null), Directory(id=DirectedTypeBUR003, code=BUR003, description=Имеет члена жилищного объединения, type=DirectedType, value=null)]"
},
"lang": "painless",
"source": """def message = params.directories.toArray();
Debug.explain(message);
if (ctx._source.businessPartnerParams != null) {
ctx._source.businessPartnerParams.bpName = 'test 3 '
}"""
}
}
I dont get param - its string not List. How put params List?