elasticsearch v0.1.1 mix elasticsearch.build View Source

Builds Elasticsearch indexes using a zero-downtime, hot-swap technique.

  1. Build an index for the given alias, with a timestamp: alias-12323123
  2. Bulk upload data to that index using store and sources.
  3. Alias the alias to alias-12323123.
  4. Remove old indexes beginning with alias.
  5. Refresh alias-12323123.

For a functional version of this approach, see Elasticsearch.Index.hot_swap/4.

Example

$ mix elasticsearch.build posts [index2] [index3]

To build an index only if it does not exist, use the --existing option:

$ mix elasticsearch.build posts --existing
Index posts already exists.