您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何使用logstash在两个索引上创建别名?

如何使用logstash在两个索引上创建别名?

据我所知,没有办法直接用logstash做到这一点。您可以使用Elasticsearch API从外部程序执行此操作:http ://www.elastic.co/guide/en/elasticsearch/reference/current/indices- aliases.html

例如:

curl -XPOST 'http://localhost:9200/_aliases' -d '
{
    "actions" : [
        { "add" : { "index" : "indexA-2015.01.01", "alias" : "alias-2015.01.01" } },
        { "add" : { "index" : "indexB-2015.01.01", "alias" : "alias-2015.01.01" } }
    ]
}'

一个选项(不满足您将其命名为的要求alias-yyyy.mm.dd)是使用创建索引时自动添加别名的索引模板。

参见http://www.elastic.co/guide/en/elasticsearch/reference/current/indices- templates.html:

curl -XPUT localhost:9200/_template/add_alias_template -d '{
  "template" : "index*",
  "aliases" : {
    "alias" : {}
    }
  }
}'

这将为alias每个名为index*的索引添加别名。

然后,您可以针对别名进行所有查询。您可以在Kibana中将该别名设置为索引,然后一切正常。

其他 2022/1/1 18:22:00 有568人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶