有时在索引中添加新字段时,它们不会在 elasticsearch 中建立索引

sometimes when adding new fields in index, they don't get indexed in elasticsearch

假设我有一个索引 test 并且已经存在。我想为数据库中的所有文档添加一个新字段 newfield1,其中包含一些数据。目前,我只是简单地删除所有内容,然后重新插入添加了 newfield1 数据的数据。我知道这不是最有效的方法,但这不是我现在的问题。

有时 newfield1 中的数据没有被索引,我无法在 Kibana 中将其可视化。这很烦人。我做的有问题吗?

注意:我可以在 ElasticSearch 中查询这个字段,这让我觉得 Kibana 有问题

这里没什么好说的,但首先要确保你的集群是绿色的。

$ curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'

如果您仍在努力了解集群的状态,那么或许可以考虑安装 HQ 等插件 https://github.com/royrusso/elasticsearch-HQ

Kibana 缓存字段映射。转到设置 -> 索引,select 您的索引,然后单击橙色 "Refresh" 按钮。