Unable to update the ES using http-output-plugin

http {
url => "http://localhost:9200/test_index/_update_by_query"
format => "message"
content_type => "application/json"
message => '{"query": {"match":{ "userId": %{userId}}},"script": "ctx._source.recentStatus = %{deptId}"}'
http_method => "post"
retry_failed => false
}

This query is working. But when it is used in Logstash, It is showing error related quotes near %{userId}. Any way to resolve this ??