illegal_argument_exception data schema_error ai_generated true

Elasticsearch mapping conflict: field 'timestamp' has different type in different indices

ID: data/elasticsearch-mapping-conflict

Also available as: JSON · Markdown · 中文
84%Fix Rate
86%Confidence
1Evidence
2024-01-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Elasticsearch 7.17 active
Elasticsearch 8.6 active
Elasticsearch 8.11 active

Root Cause

When creating an index pattern or alias that spans multiple indices, Elasticsearch detects that the same field has incompatible types (e.g., 'date' in one index and 'text' in another), preventing unified search.

generic

中文

当创建跨多个索引的索引模式或别名时,Elasticsearch检测到同一字段具有不兼容的类型(如一个索引中为'date',另一个中为'text'),导致无法统一搜索。

Official Documentation

https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-mapping.html

Workarounds

  1. 90% success Reindex the conflicting indices into a new index with a unified mapping, then use an alias to point to the new index.
    Reindex the conflicting indices into a new index with a unified mapping, then use an alias to point to the new index.
  2. 75% success Use a runtime field in the index pattern to cast the conflicting field to a common type at query time.
    Use a runtime field in the index pattern to cast the conflicting field to a common type at query time.

中文步骤

  1. Reindex the conflicting indices into a new index with a unified mapping, then use an alias to point to the new index.
  2. Use a runtime field in the index pattern to cast the conflicting field to a common type at query time.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Data in the deleted index is lost unless reindexed, which can be time-consuming.

  2. 80% fail

    Dynamic mapping can still produce conflicting types across indices.