Не удалось выполнить скрипт в выводе logsta sh - PullRequest
1 голос
/ 13 марта 2020

Я хочу удалить определенное поле изasticsearch с помощью logstash, но когда я запускаю файл conf, получаю сообщение об ошибке

: -

output{
elasticsearch {
          hosts => ["http://localhost:9200"]
          index => "test"
          action => "update"
          ilm_enabled => "true"
          document_id => "%{fingerprint}"
          script_lang => "painless"
          script_type => ["inline"]
          script =>"
            Set keys = new HashSet(ctx._source.keySet());
             for(i in keys){
               if (i.incudes?('mobile')
               {
                    ctx._source.remove(i);
                } 
               }
          "
        }
  }

Ошибка: -

[2020-03-13T17:25:20,704][WARN ][logstash.outputs.elasticsearch][main] Could not index event to Elasticsearch. {:status=>400, :action=>["update", {:_id=>"20cb05210d53aa8a6bfb4e354408355358676a3398723aaac1bbc9fabb966bf8", :_index=>"test", :_type=>"_doc", :routing=>nil, :retry_on_conflict=>1}, #<LogStash::Event:0x359a0ae9>], :response=>{"update"=>{"_index"=>"test", "_type"=>"_doc", "_id"=>"20cb05210d53aa8a6bfb4e354408355358676a3398723aaac1bbc9fabb966bf8", "status"=>400, "error"=>{"type"=>"illegal_argument_exception", "reason"=>"failed to execute script", "caused_by"=>{"type"=>"script_exception", "reason"=>"compile error", "script_stack"=>["... mobile')\r\n               {\r\n                    ct ...", "                             ^---- HERE"], "script"=>"\r\n            Set keys = new HashSet(ctx._source.keySet());\r\n             for(i in keys){\r\n               if (i.incudes?('mobile')\r\n               {\r\n                    ctx._source.remove('padd');\r\n                } \r\n               }\r\n          ", "lang"=>"painless", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"unexpected token ['{'] was expecting one of [':']."}}}}}}
...