trying to pass params to elasticsearch getting null_pointer_exception

时间:2019-01-07 13:51:59

标签: javascript elasticsearch elasticsearch-painless

I'm trying to send to Elasticsearch the following query. Here is the most minimal update by query which gives me the exception. Lets name it Query1:

{ "id": "someID", "script": { "lang": "painless", "source": " if (ctx._source.containsKey('value')) { ctx._source.value = ctx._source.value + params.value; }" }, "params": { "value": 1 }, "upsert": { "value": 1 } }

Been trying to hunt down this issue for a while now. In our case the parameter value is indexed as an integer. The query it's self is being sent as part of a bulk API. Which looks like as a following:

{update: {_id:"someID", _index:"someIndex", _type:"someType"}} (Query1)

when trying to run the script it will have a run time exception: null_point_exception

params.value ^--- here

I've seen related issues to this one but non which contains solutions. In stack overflow and other sites.

1 个答案:

答案 0 :(得分:0)

在弹性论坛中提问。 params不在脚本内。