如何查找存在映射冲突的字段

mar*_*kus 7 elasticsearch logstash kibana kibana-4

我在 Kibana 中的索引设置告诉我,我的 logstash-* 索引模式中有映射冲突的字段。

找出哪些字段具有冲突映射和/或冲突发生在哪些索引中的最简单方法是什么?

Gru*_*eck 10

As of at least Kibana 5.2, you can type "conflict" into the Filter field, which will filter all fields down to only those which have a conflict. At the far right there is a column named "controls", and for each field it has a button with a pencil icon. Clicking that will tell you which indices have which mapping.

Fields filtered to only those with conflicts: 字段仅过滤到有冲突的字段

Indices in which field mapping conflicts: indices in which field mapping conflicts


Mat*_*tat 5

您可以使用 Kibana 中的映射 API 轻松找到字段的映射方式。

如果你知道你有映射冲突,我会假设你知道有冲突的字段名称。这些将列在 Management/Index Patterns/index_pattern 下

如果您有每天创建的索引,例如 production-2020.06.16,您可以使用 production* 搜索所有索引。

转到开发工具并输入此查询,更改索引模式 (production*) 和冲突的字段名称以满足您的需要。

GET production*/_mapping/field/conflictedFieldname
Run Code Online (Sandbox Code Playgroud)

这将拉出与生产* 模式匹配的所有索引,并将列出每个索引的冲突字段名的映射。滚动并查看哪个与另一个不同。

您还可以在此处查看 Elasticsearch 文档:Elasticsearch 文档:Get Field Mapping API

您遇到冲突的原因是因为 Elasticsearch 使用进入索引的第一个值来对其应该是什么数据类型做出最佳猜测。您可以通过为您关心的索引模式放置一个模板来确保它始终是相同的类型。

Elasticsearch 文档:放置索引模板

  • “我假设您知道有冲突的字段名称” - 不,问题具体是如何找到这些字段名称。 (3认同)