elasticsearch mapping_error ai_generated true

mapper_parsing_exception: failed to parse field [timestamp] of type [date]

ID: elasticsearch/mapper-parsing-exception

Also available as: JSON · Markdown
85%Fix Rate
90%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
8 active

Root Cause

Document field type does not match index mapping. Sending string where number expected, or wrong date format.

generic

Workarounds

  1. 92% success Define explicit mapping with correct field types before indexing
    PUT /my_index { 'mappings': { 'properties': { 'timestamp': { 'type': 'date', 'format': 'epoch_millis||yyyy-MM-dd' }}}}

    Sources: https://www.elastic.co/guide/en/elasticsearch/reference/current/

  2. 88% success Fix the source data to match the existing mapping
  3. 82% success Use ingest pipeline to transform data before indexing
    Use date processor in ingest pipeline to normalize date formats

Dead Ends

Common approaches that don't work:

  1. Delete and recreate the index with dynamic mapping 75% fail

    Dynamic mapping guesses types from first document; subsequent documents with different types will fail the same way

  2. Set strict_date_optional_time for all date fields 68% fail

    Only works if all dates use ISO 8601. If you have epoch timestamps or custom formats, this fails.