erosej
erosej

Reputation: 65

Field [field] not present as part of path [field.query] for Elasticsearch ingest pipeline

I'm creating an ingest pipeline in Elasticsearch with a gsub processor and I keep getting this error when testing the pipeline on a document. I had to add a unique delimiter before ingesting to deal with a whitespace issue. I'm now trying to replace that delimiter with white spaces. The delimiter is |x| and my configuration for the gsub processor is ^\\|x\\|$. I would use "ignore_failure" but then the processor will never truly work if it can't find the field I'm trying to modify.

Thanks.

Upvotes: 0

Views: 1199

Answers (1)

imotov
imotov

Reputation: 30163

The error that you are getting simply means that the processor cannot find the field you want it to replace. Since there is nothing to replace in this case and you expect some field not to have this field, you can simply suppress the error by adding "ignore_missing" to the processor:

POST /_ingest/pipeline/_simulate
{
  "pipeline" :
  {
    "description": "_description",
    "processors": [
      {
        "gsub": {
          "field" : "field.query",
          "pattern": "\\|x\\|",
          "replacement": " ",
          "ignore_missing": true
        }
      }
    ]
  },
  "docs": [
    {
      "_index": "index",
      "_id": "id",
      "_source": {
        "field": {
          "query": "foo|x|bar"
        }
      }
    },
    {
      "_index": "index",
      "_id": "id",
      "_source": {
        "field": {
          "query": "foo|x|bar and foo|x|baz"
        }
      }
    },
    {
      "_index": "index",
      "_id": "id",
      "_source": {
        "no_field": "foobar"
      }
    }
  ]
}

Upvotes: 0

Related Questions