logstash-plugins/logstash-filter-translate

Translate for multi values fields

Closed this issue · 4 comments

Mainly we are trying to add a field productName to a document before indexing it based on the document productId using the translate plugin and a yaml dictionary file containing a mapping (productId:productName). We couldn't apply the filter to all the elements of that field.
We would like to have something like that where i is [0, basketInfos.length]
translate{
field => "[basketInfos][i][productId]"
destination => "[basketInfos][i][productName]"
dictionary_path=> "/home/ms/logstash-2.1.0/dictionary.yaml"
exact => true
}

And this is a snippet of the dictionary.yaml file
"378801434": Product-111
"417509627": Product-112
"ov393627130": Product-113

Multi-value field - arrays - support would be unreal.

Looks like it's addressed in #15 but has been stale for some time.

Seems like this config would express the intent:

translate {
  field => "[productId]"
  destination => "[productName]"
  foreach => "[basketInfos]"
  dictionary_path=> "/home/ms/logstash-2.1.0/dictionary.yaml"
  exact => true
}

I can implement this and I think this is useful in the other enrichment filters too.

Closing, will be covered with PR #67