How to create an alias on two indexes with logstash? -
in cluster working on there 2 main indexes, let's indexa
, indexb
these 2 indexes indexed each day normaly have indexa-{+yyyy.mm.dd}
, indexb-{+yyyy.mm.dd}
.
what want have 1 alias gathers indexa-{+yyyy.mm.dd}
, indexb-{+yyyy.mm.dd}
, named alias-{+yyyy.mm.dd}
.
does know how gather 2 indexes in 1 alias logstash ?
thank in advance
as far know, there's no way logstash directly. can external program using elasticsearch api: http://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
for example:
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" } } ] }'
the other option (which doesn't meet requirements of having named alias-yyyy.mm.dd
) use index template automatically adds alias when index created.
see 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" : {} } } }'
this add alias of alias
every index named index
*.
you can of queries against alias. can setup alias in kibana index , things work right.
Comments
Post a Comment