On 5.6.0, when updating a field with ctx._source.field via inline script using high-level-rest-client, I'm getting unknown source setting error. It should work fine as I'm using "ctx._source" as per documentation, not "_source". So, please help on why I'm facing this issue.
Error : org.elasticsearch.ElasticsearchStatusException: Elasticsearch exception [type=illegal_argument_exception, reason=[script] unknown field [source], parser not found]
Code snippet :
UpdateRequest request = new UpdateRequest(index, type,id);
request.script(new Script(ScriptType.INLINE, "painless", scriptQuery, paramsField));
bulkRequest.add(request);
getHighLevelClient().bulk(bulkRequest);
But via API, it is working fine and field updated successfully when using same script
curl -XPOST 'http://localhost:9200/index/type/id/_update' -d '{ "script" : { "inline": "if (ctx._source.containsKey("status")) else {ctx._source.status=params.status}", "lang": "painless", "params" : { "status":"unpublished"}}}'