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 that the queries are based on; aliases allow you to group them under a common name/label.
Some common scenarios for this usage are as follows:
- Log indices divided by date (that is,
logstash-YYYY-MM-DD
) 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 a website's content in several indices (New York Times, The Guardian, and so on) for those we want to be referred to by the index alias sites.
Getting ready
You will need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands in this recipe, you can use any HTTP...