elasticsearch v1.0.0 mix elasticsearch.build View Source
Builds Elasticsearch indexes using a zero-downtime, hot-swap technique.
- Build an index for the given
alias
, with a timestamp:alias-12323123
- Bulk upload data to that index using
store
andsources
. - Alias the
alias
toalias-12323123
. - Remove old indexes beginning with
alias
. - Refresh
alias-12323123
.
For a functional version of this approach, see
Elasticsearch.Index.hot_swap/4
.
Options
--cluster
: The Elasticsearch.Cluster
to build the indexes to.
--bulk-page-size
: (Optional) The number of documents to post to the cluster in each
bulk page upload. Default: 5000
--bulk-wait-interval
: (Optional) The number of milliseconds to wait between posting
each bulk page, to avoid overloading your cluster. Default: 0
Example
$ mix elasticsearch.build posts [index2] [index3] --cluster MyApp.Cluster
To build an index only if it does not exist, use the --existing
option:
$ mix elasticsearch.build posts --existing --cluster MyApp.Cluster
Index posts already exists.
You can also specify --bulk-page-size
and --bulk-wait-interval
manually:
$ mix elasticsearch.build posts --cluster MyApp.Cluster --bulk-page-size 1000 --bulk-wait-interval 500