Using index aliases
Real world applications have a lot of indices and queries that span on more indices. This scenario requires defining all the names of indices on which to we need to perform queries; aliases allow grouping them in a common name.
Some common scenarios of this usage are as follows:
Log indices divided by date (that is,
log_YYMMDD
) for which we want to create an alias forthe last week
,the last month
,today
,yesterday
, and so on"Collecting" website contents in several indices (
New York Times
,The Guardian
, and so on) for those we want to refer as an index alias "sites"
Getting ready
You need a working ElasticSearch cluster.
How to do it...
The URL format for control aliases are as follows:
http://<server>/_aliases
For managing the index aliases, we need to perform the following steps:
We are reading aliases status via REST API, so the method will be GET and an example of call is as follows:
curl -XGET 'http://localhost:9200/_aliases'
You will get a response similar to the...