Logstash output elasticsearch script error


(Xingzhi Zhang) #1

I need to update the local field json in elasticsearch and get an error.

My script file output elasticsearch is:
script =>"ctx._source.supplier.%{gys}.kcl=params.event.get('message')"

error:
[2019-04-16T14:11:53,468][WARN ][logstash.outputs.elasticsearch] Could not index event to Elasticsearch. {:status=>400, :action=>["update", {:_id=>"2018080218182069036", :_index=>"test_bls", :_type=>"doc", :_routing=>nil, :_retry_on_conflict=>3}, #LogStash::Event:0x5a47a394], :response=>{"update"=>{"_index"=>"test_bls", "_type"=>"doc", "_id"=>"2018080218182069036", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"failed to execute script", "caused_by"=>{"type"=>"script_exception", "reason"=>"runtime error", "script_stack"=>["ctx._source.supplier.67355576741431019538494530675210.kcl=params.event.get('message')", " ^---- HERE"], "script"=>"ctx._source.supplier.67355576741431019538494530675210.kcl=params.event.get('message')", "lang"=>"painless", "caused_by"=>{"type"=>"null_pointer_exception", "reason"=>nil}}}}}}