# Translate plugin, iterate\_on and item id on fallback

**URL:** <https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205>\
**Category:** Logstash\
**Created:** [September 14, 2021, 4:39pm UTC](https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205 "2021-09-14T16:39:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastic\_user\_forum](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@elastic\_user\_forum](https://discuss.elastic.co/u/elastic_user_forum)\
**Post date:** [September 14, 2021, 4:39pm UTC](https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205/1 "2021-09-14T16:39:09Z")

</div>

Hi everyone,

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

I have the following dictionary.json

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

```

I'm trying to enrich the following field

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

```

My translate part is

```auto
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

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

```

But I'm getting

```auto
"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.

---

<div class="post-metadata">

**Author:** ![elastic\_user\_forum](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@elastic\_user\_forum](https://discuss.elastic.co/u/elastic_user_forum)\
**Post date:** [September 27, 2021, 3:07pm UTC](https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205/2 "2021-09-27T15:07:38Z")

</div>

Hi everyone,

Any help on this topic please 🥺

Thanks a lot

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [September 27, 2021, 6:07pm UTC](https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205/3 "2021-09-27T18:07:40Z")

</div>

> [@elastic\_user\_forum](#):
>
> 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)

No you cannot do that. The [code](https://github.com/logstash-plugins/logstash-filter-translate/blob/e3670bb3137437ad05a90036a90b4711a67e04ea/lib/logstash/filters/array_of_values_update.rb#L34) makes a call to Array.fill with the sprintf'd value of the fallback option.

---

<div class="post-metadata">

**Author:** ![elastic\_user\_forum](https://avatars.discourse-cdn.com/v4/letter/e/65b543/32.png) [@elastic\_user\_forum](https://discuss.elastic.co/u/elastic_user_forum)\
**Post date:** [September 28, 2021, 8:23am UTC](https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205/4 "2021-09-28T08:23:20Z")

</div>

Not what I was expected but thanks for your answer.

Have a nice day.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 26, 2021, 8:24am UTC](https://discuss.elastic.co/t/translate-plugin-iterate-on-and-item-id-on-fallback/284205/5 "2021-10-26T08:24:17Z")

</div>

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