# Painless error

**URL:** <https://discuss.elastic.co/t/painless-error/295335>\
**Category:** Elasticsearch\
**Tags:** painless\
**Created:** [January 25, 2022, 10:59am UTC](https://discuss.elastic.co/t/painless-error/295335 "2022-01-25T10:59:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tuckson](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tuckson](https://discuss.elastic.co/u/Tuckson)\
**Post date:** [January 25, 2022, 10:59am UTC](https://discuss.elastic.co/t/painless-error/295335/1 "2022-01-25T10:59:05Z")

</div>

Question is easy (and yes I am new to this painfull stuff), what am I doing wrong?

```auto
{
  "docs": [
    {
      "error": {
        "root_cause": [
          {
            "type": "script_exception",
            "reason": "runtime error",
            "script_stack": [
              "ctx['additional-data'].value.contains('qs:')",
              " ^---- HERE"
            ],
            "script": "ctx['additional-data'].value.contains('qs:')",
            "lang": "painless",
            "position": {
              "offset": 22,
              "start": 0,
              "end": 44
            }
          }
        ],
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "ctx['additional-data'].value.contains('qs:')",
          " ^---- HERE"
        ],
        "script": "ctx['additional-data'].value.contains('qs:')",
        "lang": "painless",
        "position": {
          "offset": 22,
          "start": 0,
          "end": 44
        },
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "dynamic getter [java.lang.String, value] not found"
        }
      }
    }
  ]
}

```

Better said, what is the RIGHT way to do this? I am creating a pipeline with a processor with a conditional

The concerning part of the pipeline:

```auto
      {
        "dissect" : {
          "field" : "additional-data",
          "pattern" : "RC: %{ms-result} | executionTime(ms): %{execution-time}",
          "if" : "ctx['additional-data'].value.contains('qs:')"
        }
      }

```

Thnx

---

<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:** [January 25, 2022, 12:39pm UTC](https://discuss.elastic.co/t/painless-error/295335/2 "2022-01-25T12:39:19Z")

</div>

The `.value` notation only applies to doc values, try just `ctx['additional-data']` within the context of an ingest pipeline (compared to the context of a script filter for example or a scripted aggregation).

---

<div class="post-metadata">

**Author:** ![Tuckson](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tuckson](https://discuss.elastic.co/u/Tuckson)\
**Post date:** [January 25, 2022, 1:58pm UTC](https://discuss.elastic.co/t/painless-error/295335/3 "2022-01-25T13:58:33Z")

</div>

Thanks for your quick reply. I don't know if it works now because I bump into another issue, but the error I bumped onto is gone, so I will mark your reply as solution.

---

<div class="post-metadata">

**Author:** ![Tuckson](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@Tuckson](https://discuss.elastic.co/u/Tuckson)\
**Post date:** [January 25, 2022, 4:24pm UTC](https://discuss.elastic.co/t/painless-error/295335/4 "2022-01-25T16:24:54Z")

</div>

- Deleted

---

<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:** [February 22, 2022, 4:25pm UTC](https://discuss.elastic.co/t/painless-error/295335/5 "2022-02-22T16:25:40Z")

</div>

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