我对elasticsearch技术还很陌生,现在正在努力创建一个索引模板,这个模板将应用于所有新的索引,但无法创建正确的索引。
目前运行的elasticsearch 7.9.2及其文档索引模板 index_patterns
字段是必需的,应为通配符数组( *
匹配任何字符串)。
当然我试过用 ["*"]
作为通过kibana控制台请求的模式:
PUT _index_template/template_1
{
"index_patterns": ["*"],
"priority": 0
}
我有:
{
"error" : {
"root_cause" : [
{
"type" : "null_pointer_exception",
"reason" : null
}
],
"type" : "null_pointer_exception",
"reason" : null
},
"status" : 500
}
而对于添加为空的请求 settings
:
PUT _index_template/template_1
{
"index_patterns": ["*"],
"template": {
"settings": {
}
},
"priority": 0
}
我收到:
# ! Deprecation: index template [template_1] has index patterns [*] matching patterns from existing older templates [.monitoring-es,.triggered_watches,.management-beats,.transform-internal-005,.logstash-management,.monitoring-kibana,.kibana-event-log-7.9.2-template,.ml-config,.watch-history-11,.ml-meta,ilm-history,.monitoring-logstash,.ml-state,.slm-history,.ml-inference-000002,.monitoring-beats,.monitoring-alerts-7,.ml-anomalies-,.watches,.ml-notifications-000001,.transform-notifications-000002,.ml-stats] with patterns (.monitoring-es => [.monitoring-es-7-*],.triggered_watches => [.triggered_watches*],.management-beats => [.management-beats],.transform-internal-005 => [.transform-internal-005],.logstash-management => [.logstash],.monitoring-kibana => [.monitoring-kibana-7-*],.kibana-event-log-7.9.2-template => [.kibana-event-log-7.9.2-*],.ml-config => [.ml-config],.watch-history-11 => [.watcher-history-11*],.ml-meta => [.ml-meta],ilm-history => [ilm-history-2*],.monitoring-logstash => [.monitoring-logstash-7-*],.ml-state => [.ml-state*],.slm-history => [.slm-history-2*],.ml-inference-000002 => [.ml-inference-000002],.monitoring-beats => [.monitoring-beats-7-*],.monitoring-alerts-7 => [.monitoring-alerts-7],.ml-anomalies- => [.ml-anomalies-*],.watches => [.watches*],.ml-notifications-000001 => [.ml-notifications-000001],.transform-notifications-000002 => [.transform-notifications-*],.ml-stats => [.ml-stats-*]); this template [template_1] will take precedence during new index creation
{
"acknowledged" : true
}
响应只取决于空的存在 template.settings
好像有点窃听。
尽管如此,后一种方法似乎是可行的,但贬损警告听起来危险且令人沮丧(我曾尝试将优先级设置为0,但没有效果)。然而6.8版本的体育文档的例子 "*"
. 所以这种功能不久前就存在了。
如果有的话,构造“匹配所有”索引模板的正确方法是什么?
1条答案
按热度按时间eaf3rand1#
当前要匹配所有索引,您确实需要使用
*
因为索引模式和警告存在,因为它将匹配任何内容,包括内部系统索引。根据模板中的内容,这可能会导致工作不正常或破坏系统。
github上有一个关于它的公开问题,主要是关于
.security
索引,当您使用match-all索引模式时,它也会受到影响,还有一个问题也涉及到这个问题。