# Cant index field with ingest pipeline

**URL:** <https://discuss.elastic.co/t/cant-index-field-with-ingest-pipeline/268586>\
**Category:** Logstash\
**Created:** [March 28, 2021, 1:13pm UTC](https://discuss.elastic.co/t/cant-index-field-with-ingest-pipeline/268586 "2021-03-28T13:13:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandros888](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alexandros888](https://discuss.elastic.co/u/Alexandros888)\
**Post date:** [March 28, 2021, 1:13pm UTC](https://discuss.elastic.co/t/cant-index-field-with-ingest-pipeline/268586/1 "2021-03-28T13:13:02Z")

</div>

Hello,

I am facing the following issue

Steps:

1. I am creating without problem the following ingest pipeline:

2. I am creating without problem the following index:

3. I try to index the following document

> PUT /test3/\_doc/1  
> {
> 
> "http.request.body.original":
> 
> {"ArticleNr":"471776","sendMethod":"TOUR","partialDelivery":false,"isTourTimetable":false,"deliveryAddressId":"1000000028658646379","items":[{"articleId":1001223455,"quantity":1},{"articleId":1001058014,"quantity":1},{"articleId":1001058015,"quantity":1},{"articleId":1001058019,"quantity":1},{"articleId":1001058017,"quantity":1}]}
> 
> }

BUT i get the exact error message below:

```
    {
      "error" : {
        "root_cause" : [
          {
            "type" : "script_exception",
            "reason" : "runtime error",
            "script_stack" : [
              "ctx.number_of_articles = ctx.http.request.body.original.items.length;\r\n \r\n ",
              " ^---- HERE"
            ],
            "script" : " ...",
            "lang" : "painless",
            "position" : {
              "offset" : 60,
              "start" : 27,
              "end" : 118
            }
          }
        ],
        "type" : "script_exception",
        "reason" : "runtime error",
        "script_stack" : [
          "ctx.number_of_articles = ctx.http.request.body.original.items.length;\r\n \r\n ",
          " ^---- HERE"
        ],
        "script" : " ...",
        "lang" : "painless",
        "position" : {
          "offset" : 60,
          "start" : 27,
          "end" : 118
        },
        "caused_by" : {
          "type" : "null_pointer_exception",
          "reason" : "Cannot invoke \"Object.getClass()\" because \"callArgs[0]\" is null"
        }
      },
      "status" : 400
    }

```

How can i change the ingest pipeline code so that doesnt throw an error when trying to index my field?

**IMPORTANT NOTE:** If i dont use the ingest pipeline in the index settings and try to index the document no problem occurs. So i believe i must change something in my ingest pipeline script....

Best regards,

Alexandros

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 28, 2021, 4:10pm UTC](https://discuss.elastic.co/t/cant-index-field-with-ingest-pipeline/268586/2 "2021-03-28T16:10:26Z")

</div>

The "shorthand" dot notation syntax you are using to post the doc does not wortk with processors.

```
PUT /test3/_doc/1
{

"http.request.body.original": <!--- Here

```

See [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/dot-expand-processor.html#dot-expand-processor) for an explanation

Try this...

```
PUT /test3/_doc/1
{
  "http": {
    "request": {
      "body": {
        "original": {
          "ArticleNr": "471776",
          "sendMethod": "TOUR",
          "partialDelivery": false,
          "isTourTimetable": false,
          "deliveryAddressId": "1000000028658646379",
          "items": [
            {
              "articleId": 1001223455,
              "quantity": 1
            },
            {
              "articleId": 1001058014,
              "quantity": 1
            },
            {
              "articleId": 1001058015,
              "quantity": 1
            },
            {
              "articleId": 1001058019,
              "quantity": 1
            },
            {
              "articleId": 1001058017,
              "quantity": 1
            }
          ]
        }
      }
    }
  }
}

GET test3/_doc/1
{
  "_index" : "test3",
  "_type" : "_doc",
  "_id" : "1",
  "_version" : 1,
  "_seq_no" : 0,
  "_primary_term" : 1,
  "found" : true,
  "_source" : {
    "http" : {
      "request" : {
        "body" : {
          "original" : {
            "isTourTimetable" : false,
            "deliveryAddressId" : "1000000028658646379",
            "ArticleNr" : "471776",
            "sendMethod" : "TOUR",
            "partialDelivery" : false,
            "items" : [
              {
                "quantity" : 1,
                "articleId" : 1001223455
              },
              {
                "quantity" : 1,
                "articleId" : 1001058014
              },
              {
                "quantity" : 1,
                "articleId" : 1001058015
              },
              {
                "quantity" : 1,
                "articleId" : 1001058019
              },
              {
                "quantity" : 1,
                "articleId" : 1001058017
              }
            ]
          }
        }
      }
    },
    "number_of_articles" : 5
  }
}
```

---

<div class="post-metadata">

**Author:** ![Alexandros888](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Alexandros888](https://discuss.elastic.co/u/Alexandros888)\
**Post date:** [March 28, 2021, 6:25pm UTC](https://discuss.elastic.co/t/cant-index-field-with-ingest-pipeline/268586/3 "2021-03-28T18:25:05Z")

</div>

> [@stephenb](#):
>
> ```auto
> PUT /test3/_doc/1
> {
> "http": {
> "request": {
> "body": {
> "original": {
> "ArticleNr": "471776",
> "sendMethod": "TOUR",
> "partialDelivery": false,
> "isTourTimetable": false,
> "deliveryAddressId": "1000000028658646379",
> "items": [
> {
> "articleId": 1001223455,
> "quantity": 1
> },
> {
> "articleId": 1001058014,
> "quantity": 1
> },
> {
> "articleId": 1001058015,
> "quantity": 1
> },
> {
> "articleId": 1001058019,
> "quantity": 1
> },
> {
> "articleId": 1001058017,
> "quantity": 1
> }
> ]
> }
> }
> }
> }
> }
> 
> ```

Hello Stephen. it worked perfectly!!!!!!!!!!!!!!! Thank you very much !!!!!!!!!!!!!!!!!!!!!!!! 🙂

---

<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:** [April 25, 2021, 6:25pm UTC](https://discuss.elastic.co/t/cant-index-field-with-ingest-pipeline/268586/4 "2021-04-25T18:25:38Z")

</div>

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