【发布时间】:2022-01-14 11:14:21
【问题描述】:
我正在尝试使用摄取节点管道为弹性中的命名空间实现条件索引。我使用了下面的管道,但是当我在 metricbeat.yml 中添加管道时创建的索引是数据流的形式。
PUT _ingest/pipeline/sample-pipeline
{
"processors": [
{
"set": {
"field": "_index",
"copy_from": "metricbeat-dev",
"if": "ctx.kubernetes?.namespace==\"dev\"",
"ignore_failure": true
}
}
]
}
预期的索引名称是 metricbeat-dev,但我将 _index 中的值作为 .ds-metricbeat-dev 获取。 当我使用一个文档进行测试时,这很好用,但是当我在 yml 文件中实现它时,我得到了以 .ds 开头的索引名称 - 为什么会发生这种情况?
模板更新:
{
"metricbeat" : {
"order" : 1,
"index_patterns" : [
"metricbeat-*"
],
"settings" : {
"index" : {
"lifecycle" : {
"name" : "metricbeat",
"rollover_alias" : "metricbeat-metrics"
},
【问题讨论】:
-
这可能是因为
metricbeat-*的索引模板可以启用数据流。你能检查一下运行GET _template/metricbeat*时得到了什么吗? -
我可以找到一个模板指向我的索引模式 metricbeat-* 这可能是问题吗?
-
你能用那个模板定义更新你的问题吗(不需要映射和设置部分,只需要顶级部分)
-
更新了问题
-
模板不完整,请添加整个模板,没有
mappings和settings的内容。另请检查以下端点GET _index_template/metricbeat*
标签: elasticsearch elastic-stack elk