Logstash only insert fields in script

hi
I am using Logstash to query MySQL database and insert its data to Elasticsearch cluster.
In my Elasticsearch output plugin I use a script like the following
script => 'if (ctx._source.nameslist== null){
ctx._source.nameslist= new ArrayList();
}
if(!ctx._source.nameslist.contains("%{name}")){
ctx._source.nameslist.add("%{name}");
}'
However logstash only inserts the field I use in the scripts and does not insert the other fields to my Elasticsearch. Is this normal? Do I have to add all the fields in the script? I have a lot of fields that I only want to insert them with no change.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.