我在Heroku上使用盆景彈性搜索和我有一個文件如下:ElasticsearchIllegalArgumentException時更新腳本
{
"_index":"myIndex",
"_type":"result",
"_id":"1234_is",
"_version":1,
"found":true,
"_source":{
"query":"is",
"pubId":1234,
"counter":1
}
}
我試圖更新這樣的計數器(按http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/docs-update.html):
curl -XPOST 'http://ELASTICSEARCHINSTANCE:9200/myIndex/result/1234_is/_update' -d '{"script" : "ctx._source.counter+=1"}'
但我發現了以下錯誤:
{
"error":"ElasticsearchIllegalArgumentException[failed to execute script]; nested: ExpressionScriptCompilationException[Failed to parse expression: ctx._source.counter+=1]; nested: ParseException[ unexpected character '1' at position (21).]; nested: MismatchedTokenException; ",
"status":400
}