# Elasticsearch: mapper_parsing_exception: failed to parse field [x] of type [date]

**Code:** `mapper_parsing_exception` · **Category:** API · **Seen on:** Elasticsearch, OpenSearch

A document value does not fit the field's mapping, so the document was rejected.

## Meaning

Once a field is mapped as `date`, `long` or `boolean`, values of another shape (a string where a number is expected) fail with a 400. The `caused_by` explains which value.

## Common causes

- Value type differs from the mapping (string vs number)
- Date format not matching `format`
- Dynamic mapping guessed a type from the first document
- Object where a scalar is mapped

## Quick fix

1. Fix the data to match the mapping
2. Set `format` on date fields
3. Define explicit mappings instead of relying on dynamic mapping

## Detailed fix by platform

### Elasticsearch

1. `GET my-index/_mapping` then create a new index with the right mapping and `_reindex`

## How to diagnose

1. **Field** — Which one?
2. **Mapping** — Declared type?
3. **Value** — Actual sent value?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/api/elasticsearch-mapper-parsing-exception)
