在 Elasticsearch 中使用文本字段进行聚合
Using text field for aggregations in Elasticsearch
当我尝试加载我的可视化时,我在 Kibana 中收到以下错误。
Visualize: Fielddata is disabled on text fields by default. Set fielddata=true on [beat.name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.
所以我尝试添加未分析的关键字字段,并根据此 LINK 为聚合启用 doc_values。
因为我正在创建每日索引,所以我创建了一个模板:
PUT /_template/template_metricbeat_1
{
"template": "*metricbeat*",
"order": 1,
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1,
"refresh_interval": "30s"
},
"mappings": {
"metricsets": {
"properties": {
"beat.name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}
但我有大约五十个文本字段可用于创建可视化。
所以我的问题是如何一次性将未分析的关键字字段添加到我所有的五十个文本字段中?
通常使用 Beats 的正确方法是使用它们自己的索引模板,每个模板都有其特定的字段和配置。
Metricbeat 专用模板在这里:https://github.com/elastic/beats/blob/v5.3.0/metricbeat/metricbeat.template.json
有关如何获取和应用它的文档在此处:https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-template.html
当我尝试加载我的可视化时,我在 Kibana 中收到以下错误。
Visualize: Fielddata is disabled on text fields by default. Set fielddata=true on [beat.name] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.
所以我尝试添加未分析的关键字字段,并根据此 LINK 为聚合启用 doc_values。
因为我正在创建每日索引,所以我创建了一个模板:
PUT /_template/template_metricbeat_1
{
"template": "*metricbeat*",
"order": 1,
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1,
"refresh_interval": "30s"
},
"mappings": {
"metricsets": {
"properties": {
"beat.name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
}
}
}
但我有大约五十个文本字段可用于创建可视化。
所以我的问题是如何一次性将未分析的关键字字段添加到我所有的五十个文本字段中?
通常使用 Beats 的正确方法是使用它们自己的索引模板,每个模板都有其特定的字段和配置。
Metricbeat 专用模板在这里:https://github.com/elastic/beats/blob/v5.3.0/metricbeat/metricbeat.template.json
有关如何获取和应用它的文档在此处:https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-template.html