Using index aliases
Real-world applications have a lot of indices and queries that span more indices. This scenario requires defining all the indices' names on which queries are based; aliases allow grouping of them under a common name.
Some common scenarios for this usage are as follows:
- Log indices divided by date (that is,
log_YYMMDD
) for which we want to create an alias for the last week, the last month, today, yesterday, and so on. This pattern is commonly used in log applications such as Logstash (https://www.elastic.co/products/logstash). - Collecting website contents in several indices (New York Times, The Guardian, ...) for those we want to be referred to by the index alias sites.
Getting ready
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
To execute these commands, HTTP clients can be used, such as curl (https://curl.haxx.se/), postman (https://www.getpostman.com/), or others...