# Add a field when a match between an external dictionary and a field from a filebeat document occurrs

**URL:** <https://discuss.elastic.co/t/add-a-field-when-a-match-between-an-external-dictionary-and-a-field-from-a-filebeat-document-occurrs/304894>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 17, 2022, 7:23am UTC](https://discuss.elastic.co/t/add-a-field-when-a-match-between-an-external-dictionary-and-a-field-from-a-filebeat-document-occurrs/304894 "2022-05-17T07:23:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticLiver](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elasticliver/32/64869_2.png) [@ElasticLiver](https://discuss.elastic.co/u/ElasticLiver)\
**Post date:** [May 17, 2022, 7:23am UTC](https://discuss.elastic.co/t/add-a-field-when-a-match-between-an-external-dictionary-and-a-field-from-a-filebeat-document-occurrs/304894/1 "2022-05-17T07:23:55Z")

</div>

Hi, in filebeat can I add a field when a match between an external dictionary and a field from a filebeat document occurrs?

Im already doing this with an ingest pipeline and an enrich proccesor, but the ingestion is to slow, and I got others pipelines from logstash running, so I wash thinking maybe I can use the filebeat machine power to do this.

For example in logstash I can create an external dictionary that check if a field match with the key, and add a field with the value of the dictionary

```auto
def register(params)
end

def filter(event)
        dic = {
1 => "tcpmux ",
2 => "compressnet",  
3 => "compressnet "
};
        event.set('new_field', dic[event.get("incoming_field")])
        return [event]
end

```

It is posible something similar in filebeat?

Thanks!

---

<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:** [June 14, 2022, 9:24am UTC](https://discuss.elastic.co/t/add-a-field-when-a-match-between-an-external-dictionary-and-a-field-from-a-filebeat-document-occurrs/304894/2 "2022-06-14T09:24:20Z")

</div>

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