Ingest Pipeline: drop processor: compile error

As documented here
https://www.elastic.co/guide/en/elasticsearch/reference/current/drop-processor.html

I want to be able to drop a document when matching on a field, like so

    {
      "processors": [
    {
      "json": {
        "field": "message",
        "add_to_root": true,
        "ignore_failure": true
      }
    },
    {
      "drop": {
        "if": "req.url == '/api/v1/health'",
        "ignore_failure": true
      }
    }
      ]
    }

But I am getting a compile error in the ingest ui. The browser dev tool inspector gives me this reason why:

400 Bad Request

type: illegal_argument_exception
reason: cannot resolve symbol [req.url]

I can provide additional screenshots if needed.

Can you share an example document?

If the field is called req.url, I think it has to be referenced by ctx.req.url in the condition.

Hi,

Thanks for that tip, it did accept the ctx. prefix to the field, I'll check on how it works. Appreciate it

Think of the if as a mini script - "ctx" is the variable containing the current document. ctx.req.url is looking up the value for the object.

It's similar to this: https://www.elastic.co/guide/en/elasticsearch/painless/current/painless-ingest-processor-context.html

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