Many thanks @Badger, it is working.
For reference, if someone should encounter the same:
input {
file {
path => "d:/uae.txt"
start_position => "beginning"
sincedb_path => "NUL"
mode => "tail"
}
}
filter {
elasticsearch {
hosts => "http://localhost:9200"
query_template => "c:/logstash/config/search.json"
index => "address"
fields => {
"City" => "City"
"State" => "State"
}
}
}
filter {
ruby { code => "
c = event.get('City')
s = event.get('State')
a = []
c.each_index { |k|
h = { 'city' => c[k], 'state' => s[k] }
a << h
}
event.set('arrayOfHashes', a)
"
}
}
filter {
split {
field => "arrayOfHashes"
}
}
output {
csv {
csv_options => {
"col_sep" => ";"
"force_quotes" => true
}
fields => ["[arrayOfHashes][city]", "[arrayOfHashes][state]"]
path => "d:/result.txt"
}
stdout {codec => rubydebug}
}