# Mapper\_parsing\_exception error

**URL:** <https://discuss.elastic.co/t/mapper-parsing-exception-error/334447>\
**Category:** Elasticsearch\
**Created:** [May 26, 2023, 3:01pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447 "2023-05-26T15:01:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruwi](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Ruwi](https://discuss.elastic.co/u/Ruwi)\
**Post date:** [May 26, 2023, 3:01pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/1 "2023-05-26T15:01:07Z")

</div>

Hi all,

I create indexes on a daily basis using fluentd in Elasticsearch. I don't do any mapping on elasticsearch side. After a while, the related index could not be created in Elasticsearch and I got the following error. There is a template for ilm policy. I deleted the previously created indexes, template and ilm policy. I restarted Elasticsearch and Kibana. When I create an index with an index name that matches the old index pattern and send data to Kibana, I still get the same error. But when I give the index name different, there is no problem. Is this a bug? How can I solve it?

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "object mapping for [Direction] tried to parse field [Direction] as object, but found a concrete value"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "object mapping for [Direction] tried to parse field [Direction] as object, but found a concrete value"
  },
  "status" : 400
}

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [May 26, 2023, 4:11pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/2 "2023-05-26T16:11:13Z")

</div>

It means that some data in your index have been first created as:

```auto
{
  "Direction": {
    "foo": "bar"
  }
}

```

But new documents are coming as:

```auto
{
  "Direction": "bar"
}

```

Which can not work.

You need to fix your source of data or disable this field so it's not indexed (and not searchable as a consequence).

---

<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:** [May 26, 2023, 7:11pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/3 "2023-05-26T19:11:56Z")

</div>

Here is a little further explanation of what is happening

> [@Logstash Parser error - tried to parse field as object, but found a concrete value](https://discuss.elastic.co/t/logstash-parser-error-tried-to-parse-field-as-object-but-found-a-concrete-value/269140/4):
>
> Try this test, hopefully this makes it clearer POST test/\_doc { "myfield" : "myvalue", "myotherfield" : { "mysubfield1" : "mysubvalue1", "mysubfield2" : "mysubvalue2" } } Then Post POST test/\_doc { "myfield" : "myvalue", "myotherfield" : "myconcretevalue" } and you will get this error. { "error" : { "root\_cause" : [{ "type" : "mapper\_parsing\_exception", "reason" : "object mapping for [myotherfield] tried to parse field [myotherfield] as objec…

And Here is a sample code how you might fix something like this with an ingest pipeline.

> [@Field with different types on same index](https://discuss.elastic.co/t/field-with-different-types-on-same-index/315047/5):
>
> Just in case you are interest here is a sample ingest pipeline / simulate with various combinations ## Ingest Pipeline Concrete / Object POST \_ingest/pipeline/\_simulate { "pipeline": { "processors": [{ "rename": { "if": "ctx?.notes instanceof String", "field": "notes", "target\_field": "notes.value", "ignore\_failure": false } }] }, "docs": [ { "\_source": { "id": "8f22efb2-6a2a-4cb7-9d0b-01ca0d6…

---

<div class="post-metadata">

**Author:** ![Ruwi](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Ruwi](https://discuss.elastic.co/u/Ruwi)\
**Post date:** [May 29, 2023, 9:45am UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/4 "2023-05-29T09:45:27Z")

</div>

Yes, I understand the problem. But there is a situation. My problematic indexes are as follows: test-\<date\_format\>

I deleted all indexes like this: DELETE test-\*  
NOTE: I am not using any mapping.

I send request from Kibana ui like this, but I still get the same error:

```auto
POST test-20230529/_doc
{
   "Direction" : "rq"
}

```

When I name the index completely different and run the above command, I don't get any errors.

---

<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:** [May 29, 2023, 2:17pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/5 "2023-05-29T14:17:31Z")

</div>

What you described in the previous post means that you have a index template that is creating a mapping that matches the index name...so check your templates

Default mapping would not reject that post command... If that is the first document posted

Back to the larger issue ...There is no fix without some choices/ work.

I showed you a sample ingest pipeline that could address the problem, something like that is prob your best approach

Otherwise the the docs that cannot be mapped will continue to be dropped.

Exactly what error do you get when you post that?

---

<div class="post-metadata">

**Author:** ![Ruwi](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Ruwi](https://discuss.elastic.co/u/Ruwi)\
**Post date:** [May 31, 2023, 12:13pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/6 "2023-05-31T12:13:51Z")

</div>

Yes! It worked. Thanks.  
Do pipelines increase resource usage a lot?

---

<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:** [May 31, 2023, 2:01pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/7 "2023-05-31T14:01:26Z")

</div>

It depends how complex.  
For something like that not much.

You can get some stats

> **[Ingest pipelines | Elasticsearch Guide \[8.8\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest.html#get-pipeline-usage-stats)**

---

<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:** [June 28, 2023, 2:01pm UTC](https://discuss.elastic.co/t/mapper-parsing-exception-error/334447/8 "2023-06-28T14:01:59Z")

</div>

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