# Ingest Node: Fixing Conflicts

**URL:** <https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247>\
**Category:** Elasticsearch\
**Created:** [June 18, 2019, 12:13pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247 "2019-06-18T12:13:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dawiro](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dawiro](https://discuss.elastic.co/u/dawiro)\
**Post date:** [June 18, 2019, 12:13pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/1 "2019-06-18T12:13:27Z")

</div>

Hi,  
Can someone show me how I can convert a simple string to an object using an ingestion pipeline?

For example, I have logs including `error` objects containing entires such as `error.message`. And there are other inbound logs containing `error` strings. How should I go about converting `error` to `error.message` so it gets indexed as an object?

Regards,  
D

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 18, 2019, 12:26pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/2 "2019-06-18T12:26:52Z")

</div>

How about this example, where you can check the type of an object and then convert it to a hashmap using a script processor

```auto
POST _ingest/pipeline/_simulate
{
  "pipeline": {
    "processors": [
      {
        "script": {
          "source": "if (ctx.error instanceof Map) { ctx.error.foo = 'bar'; } else if (ctx.error instanceof String) { def message = ctx.error ; ctx.error = [:] ; ctx.error.message = message; }"
        }
      }
    ]
  },
  "docs": [
    {
      "_source": {
        "error": "this is a string"
      }
    },
    {
      "_source": {
        "error": {
          "message": "this is an object"
        }
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![dawiro](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dawiro](https://discuss.elastic.co/u/dawiro)\
**Post date:** [June 18, 2019, 12:33pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/3 "2019-06-18T12:33:04Z")

</div>

Thx @spinscale. How will this impact ingestion throughput?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [June 18, 2019, 12:36pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/4 "2019-06-18T12:36:57Z")

</div>

There will be a reduction in throughput as every index operation needs to operate this script. The exact impact in terms of performance or percentage depends highly on your hardware and additional resources available, so it is hard to tell from the outside. The good thing is, that you can scale this part of your indexing separately by using dedicated ingest nodes, that execute the above task independently from indexing.

--Alex

---

<div class="post-metadata">

**Author:** ![dawiro](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dawiro](https://discuss.elastic.co/u/dawiro)\
**Post date:** [June 18, 2019, 1:31pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/5 "2019-06-18T13:31:08Z")

</div>

@spinscale, that looks pretty good thx 🙂 How do I add a tag to a modified event in one of these scripts so I can track changes?

---

<div class="post-metadata">

**Author:** ![dawiro](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@dawiro](https://discuss.elastic.co/u/dawiro)\
**Post date:** [June 18, 2019, 2:37pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/6 "2019-06-18T14:37:48Z")

</div>

Ah, I see there's a tag option to the script processor 🙂

---

<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:** [July 16, 2019, 2:51pm UTC](https://discuss.elastic.co/t/ingest-node-fixing-conflicts/186247/7 "2019-07-16T14:51:32Z")

</div>

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