# Resolve mapping conflicts (kinda) automatically?

**URL:** <https://discuss.elastic.co/t/resolve-mapping-conflicts-kinda-automatically/297412>\
**Category:** Logstash\
**Created:** [February 16, 2022, 8:11pm UTC](https://discuss.elastic.co/t/resolve-mapping-conflicts-kinda-automatically/297412 "2022-02-16T20:11:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheEvilDonut](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TheEvilDonut](https://discuss.elastic.co/u/TheEvilDonut)\
**Post date:** [February 16, 2022, 8:11pm UTC](https://discuss.elastic.co/t/resolve-mapping-conflicts-kinda-automatically/297412/1 "2022-02-16T20:11:34Z")

</div>

So here's our situation.

Most of our applications use an object field named (fictional) "foo" so 🙂

foo.field\_a  
foo.field\_b  
foo.field\_c  
etc...

But from time to time a "rogue log" will come in and will contain a string field named "foo" and thus be rejected due to being in conflict.

My question is, could there be a way to detect a field as **NOT** being an object? If so I could do something like this :

```auto
if foo is not an object {
   rename foo to foo_string
}

```

Anyways to do this or am I screwed? 😅

---

<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:** [February 16, 2022, 8:55pm UTC](https://discuss.elastic.co/t/resolve-mapping-conflicts-kinda-automatically/297412/2 "2022-02-16T20:55:01Z")

</div>

You could try

```
ruby {
     code => '
        foo = event.get("foo")
        if ! foo.is_a? Hash
            event.set("foo_string", event.remove("foo"))
        end
    '
}
```

---

<div class="post-metadata">

**Author:** ![TheEvilDonut](https://avatars.discourse-cdn.com/v4/letter/t/7cd45c/32.png) [@TheEvilDonut](https://discuss.elastic.co/u/TheEvilDonut)\
**Post date:** [February 17, 2022, 2:25pm UTC](https://discuss.elastic.co/t/resolve-mapping-conflicts-kinda-automatically/297412/4 "2022-02-17T14:25:59Z")

</div>

Looks interesting. Giving this a try.

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:** [March 17, 2022, 2:26pm UTC](https://discuss.elastic.co/t/resolve-mapping-conflicts-kinda-automatically/297412/5 "2022-03-17T14:26:31Z")

</div>

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