# Dynamic dictionary in translate plugin

**URL:** https://discuss.elastic.co/t/dynamic-dictionary-in-translate-plugin/151835
**Category:** Logstash
**Created:** [October 10, 2018, 11:42am UTC](https://discuss.elastic.co/t/dynamic-dictionary-in-translate-plugin/151835 "2018-10-10T11:42:52Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MartinG](https://avatars.discourse-cdn.com/v4/letter/m/3e96dc/32.png) [@MartinG](https://discuss.elastic.co/u/MartinG)
#### Post date: [October 10, 2018, 11:42am UTC](https://discuss.elastic.co/t/dynamic-dictionary-in-translate-plugin/151835/1 "2018-10-10T11:42:52Z")

</div>

Hello community!

I would like to use a dynamic dictionary with the translate plugin. Is this possible?

The use case is, to define a dictionary in the "fields" configuration of filebeat and to check each element of the dictionary, if it exists in the message field (regex).

I tested it with this logstash configuration and it would be great if a variable could be used for the dictionary.

```
input {
  stdin {
  }
}

filter {

  mutate {
    add_field => { mydict => ["abc","ok", "ABC","ok"] }
  }

      translate {
        field => "[message]"
        destination => "[matched]"

    # working:
    # dictionary => [ "abc", "ok",
    # "ABC", "ok" ]

    # Does not work:
    dictionary => "%{mydict}"
    exact => true
    regex => true
  }

  if [matched] == "ok" {
    mutate {
      add_field => ["match","OK"]
    }
  }
}

output {
  stdout {
    codec => rubydebug {
      metadata => true
    }
  }
}

```

Any ideas?

---

<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: [November 7, 2018, 11:47am UTC](https://discuss.elastic.co/t/dynamic-dictionary-in-translate-plugin/151835/2 "2018-11-07T11:47:17Z")

</div>

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