Translate plugin, iterate_on and item id on fallback

Hi everyone,

I'm using ELK 7.13 and I have a question about the translate filter plugin.

I have the following dictionary.json

{
	"TUTU": {"identifiant": "TRANSLATE VALUE FOR TUTU"},
	"TOTO": {"identifiant": "TRANSLATE VALUE FOR TOTO"}
}

I'm trying to enrich the following field

"field_to_enrich" => [
        [0] "123",
        [1] "TUTU"
]

My translate part is

translate {
	field => "[field_to_enrich]"
	iterate_on => "[field_to_enrich]"
	destination => "[field_to_enrich]" 
	dictionary_path => "PATH_TO_DICT.json"
	exact => true
	override => true
	fallback => "%{[field_to_enrich]}"
}

I'm expecting the following result

"field_to_enrich" => [
        [0] "123",
        [1] "TRANSLATE VALUE FOR TUTU"
]

But I'm getting

"field_to_enrich" => [
        [0] "123,TUTU",
        [1] {
            "identifiant" => "TRANSLATE VALUE FOR TUTU"}
]

My question is about the possibility to use something like fallback => "%{[field_to_enrich]**[index]**}" (and not to get the entire array in the fallback)

Thanks for any help. I really appreciate it.

Hi everyone,

Any help on this topic please :pleading_face:

Thanks a lot

No you cannot do that. The code makes a call to Array.fill with the sprintf'd value of the fallback option.

Not what I was expected but thanks for your answer.

Have a nice day.

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