# Combine two fields into one via add\_fields

**URL:** <https://discuss.elastic.co/t/combine-two-fields-into-one-via-add-fields/263468>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [February 5, 2021, 8:57pm UTC](https://discuss.elastic.co/t/combine-two-fields-into-one-via-add-fields/263468 "2021-02-05T20:57:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bascht](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bascht/32/83513_2.png) [@bascht](https://discuss.elastic.co/u/bascht)\
**Post date:** [February 5, 2021, 8:57pm UTC](https://discuss.elastic.co/t/combine-two-fields-into-one-via-add-fields/263468/1 "2021-02-05T20:57:17Z")

</div>

Hey everyone.

I am trying to achieve something seemingly simple but cannot get this to work with the latest Filebeat 7.10:

I want to combine the two fields `foo.bar` and `foo.baz` into a single new field that just joins the strings.

so `{ foo.bar: "x", foo.baz: "y" }`

will become: `{ new: "combine-x-y" }`

My processor:

```auto
processors:
 - add_fields:
      when.has_fields: ["foo.bar", "foo.baz"]
      fields:
        new: "combine-${data.foo.bar}-${data.foo.baz}"

```

which will result in:

```auto
Exiting: error initializing processors: fail to unpack the add_fields configuration: missing field accessing 'processors.2.add_fields.fields.new' 

```

I tried all different interpolation styles (`%{[]}` or `${foo}` instead of `${data.foo}`) but none of them worked.

Am I missing something obvious?

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [February 5, 2021, 10:26pm UTC](https://discuss.elastic.co/t/combine-two-fields-into-one-via-add-fields/263468/2 "2021-02-05T22:26:11Z")

</div>

Hi @bascht, welcome to the Elastic community forums!

I don't believe this is possible. You may want to look into the [Script Processor](https://www.elastic.co/guide/en/beats/filebeat/current/processor-script.html) instead.

Shaunak

---

<div class="post-metadata">

**Author:** ![bascht](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bascht/32/83513_2.png) [@bascht](https://discuss.elastic.co/u/bascht)\
**Post date:** [February 6, 2021, 12:48pm UTC](https://discuss.elastic.co/t/combine-two-fields-into-one-via-add-fields/263468/3 "2021-02-06T12:48:07Z")

</div>

Interesting, thanks for the hint! It looks quite complex but I'm gonna give it a try! 🙂

---

<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:** [March 6, 2021, 2:48pm UTC](https://discuss.elastic.co/t/combine-two-fields-into-one-via-add-fields/263468/4 "2021-03-06T14:48:20Z")

</div>

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