I'm trying to retrieve data from MongoDB and remove documents that have the same values on a specific field.
For example: If the value of the field "device_uuid" of multiple documents are equal, I would like to filter these documents with duplicated fields and remain with a unique document with that field value.
I've been trying to use fingerprint to do that job, but different documents are still being created in elasticsearch, even if the field "device_uuid" are equal. The only case that it works is when all the fields are equal, then the filter is applied.
This is my code:
filter {
mutate {
remove_field => [ "_id" ]
}
fingerprint {
source => [device_uuid]
target => "fingerprint"
key => "78787878"
method => "SHA1"
concatenate_sources => true
}
}
output {
elasticsearch {
index => "logstash_test"
hosts => ["elastic_url_here"]
document_id => "%{fingerprint}"
}
stdout{
codec => rubydebug
}
}