Book Image

ElasticSearch Cookbook

By : Alberto Paro
Book Image

ElasticSearch Cookbook

By: Alberto Paro

Overview of this book

Table of Contents (20 chapters)
ElasticSearch Cookbook Second Edition
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Using index aliases


Real world applications have a lot of indices and queries that span on more indices. This scenario requires defining all the indices names on which we need to perform queries; aliases allow grouping them by a common name.

Some common scenarios of this usage are:

  • Log indices divided by date (such as 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 (http://logstash.net/).

  • Collecting website contents in several indices (New York Times, The Guardian, and so on) for those we want to refer to as an index aliases called sites.

Getting ready

You will need a working ElasticSearch cluster.

How to do it...

The URL format for control aliases are:

http://<server>/_aliases
http://<server>/<index>/_alias/<alias_name>

To manage the index aliases, we will perform the following steps:

  1. We need to read the status of the aliases for all indices via...