I'm using elasticsearch input plugin to fetch data from elasticsearch using scroll api and it returns JSON document which consists of [customerAddresses] array containing latitude & logitude fields of float type...I would like to convert those fields to String..I have tried convert plugin but its not converting to String though.
below is my logstash configuration
input {
elasticsearch {
hosts => "xxxx:9200"
index => "customer"
ssl => true
ca_file => "/app/elasticsearch/config/ssl/xxx.pem"
user => "xxx"
password => "xxx"
query => '{"query":{"match":{"_id":"NUK0001234691"}}}'
size => 500
scroll => "5m"
}
}
filter{
mutate {
remove_field => ["@timestamp","@version","tags"]
}
if ![customerId] {
drop { }
}
if [customerAddresses][latitude] {
mutate {
convert => { "[customerAddresses][latitude]" => "string" }
}
}
if [customerAddresses][longitude] {
mutate {
convert => { "[customerAddresses][longitude]" => "string" }
}
}
}
output {
stdout { codec => rubydebug }
}
However I don't see float values being converted to String..
Below is ruby debug output.
"customerAddresses" => [
[0] {
"addressLine1" => "Muslim Council of Great Britain,London",
"status" => "Active",
"longitude" => -5814.0,
"addressLine3" => nil,
"height" => nil,
"microBrick" => nil,
"latitude" => 5151902.0,
}