{
  "id": "elasticsearch/mapping-conflict-on-date-format",
  "signature": "MapperParsingException: failed to parse field [created_at] of type [date] in document with id 'doc123'. Preview of field's value: '2024-13-01'",
  "signature_zh": "映射解析异常：无法解析文档 ID 'doc123' 中类型为 [date] 的字段 [created_at]。字段值预览：'2024-13-01'",
  "regex": "MapperParsingException: failed to parse field \\[\\w+\\] of type \\[date\\] in document with id '[^']+'\\. Preview of field's value: '[^']+'",
  "domain": "elasticsearch",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "The field value does not match the expected date format defined in the mapping, such as an invalid month or a mismatched timestamp pattern.",
  "root_cause_type": "generic",
  "root_cause_zh": "字段值与映射中定义的预期日期格式不匹配，例如无效月份或时间戳模式不匹配。",
  "versions": [
    {
      "version": "elasticsearch 7.17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "elasticsearch 8.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "elasticsearch 8.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Converting date to text loses date-related query capabilities (e.g., range queries, date histograms) and may break existing queries.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This only masks the issue; malformed dates are stored as null, leading to data loss and unexpected query results.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the incoming data uses a different format (e.g., 'yyyy/MM/dd'), it will still fail after re-creation.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Update the index mapping to accept multiple date formats: PUT /my_index/_mapping { \"properties\": { \"created_at\": { \"type\": \"date\", \"format\": \"yyyy-MM-dd||yyyy/MM/dd||epoch_millis\" } } }",
      "success_rate": 0.9,
      "how": "Update the index mapping to accept multiple date formats: PUT /my_index/_mapping { \"properties\": { \"created_at\": { \"type\": \"date\", \"format\": \"yyyy-MM-dd||yyyy/MM/dd||epoch_millis\" } } }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use an ingest pipeline to preprocess the date field before indexing: PUT _ingest/pipeline/date_fix { \"description\": \"Fix date format\", \"processors\": [ { \"date\": { \"field\": \"created_at\", \"target_field\": \"created_at\", \"formats\": [ \"yyyy-MM-dd\" ], \"timezone\": \"UTC\", \"locale\": \"en\" } } ] }",
      "success_rate": 0.85,
      "how": "Use an ingest pipeline to preprocess the date field before indexing: PUT _ingest/pipeline/date_fix { \"description\": \"Fix date format\", \"processors\": [ { \"date\": { \"field\": \"created_at\", \"target_field\": \"created_at\", \"formats\": [ \"yyyy-MM-dd\" ], \"timezone\": \"UTC\", \"locale\": \"en\" } } ] }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Reindex the data with a script to transform the date: POST _reindex { \"source\": { \"index\": \"my_index\" }, \"dest\": { \"index\": \"my_index_new\" }, \"script\": { \"source\": \"if (ctx._source.created_at == '2024-13-01') { ctx._source.created_at = '2024-01-01' }\" } }",
      "success_rate": 0.8,
      "how": "Reindex the data with a script to transform the date: POST _reindex { \"source\": { \"index\": \"my_index\" }, \"dest\": { \"index\": \"my_index_new\" }, \"script\": { \"source\": \"if (ctx._source.created_at == '2024-13-01') { ctx._source.created_at = '2024-01-01' }\" } }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "更新索引映射以接受多种日期格式：PUT /my_index/_mapping { \"properties\": { \"created_at\": { \"type\": \"date\", \"format\": \"yyyy-MM-dd||yyyy/MM/dd||epoch_millis\" } } }",
    "使用摄取管道在索引前预处理日期字段：PUT _ingest/pipeline/date_fix { \"description\": \"修复日期格式\", \"processors\": [ { \"date\": { \"field\": \"created_at\", \"target_field\": \"created_at\", \"formats\": [ \"yyyy-MM-dd\" ], \"timezone\": \"UTC\", \"locale\": \"en\" } } ] }",
    "使用脚本重新索引数据以转换日期：POST _reindex { \"source\": { \"index\": \"my_index\" }, \"dest\": { \"index\": \"my_index_new\" }, \"script\": { \"source\": \"if (ctx._source.created_at == '2024-13-01') { ctx._source.created_at = '2024-01-01' }\" } }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-09-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}