illegal_argument_exception data schema_error ai_generated true

Elasticsearch映射冲突:字段'timestamp'在不同索引中类型不同

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

ID: data/elasticsearch-mapping-conflict

其他格式: JSON · Markdown 中文 · English
84%修复率
86%置信度
1证据数
2024-01-18首次发现

版本兼容性

版本状态引入弃用备注
Elasticsearch 7.17 active
Elasticsearch 8.6 active
Elasticsearch 8.11 active

根因分析

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

English

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

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 90% 失败

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

  2. 80% 失败

    Dynamic mapping can still produce conflicting types across indices.