From 90bd77ec0fca0031cf9b099d39925896da3c3fa2 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 6 Jun 2019 15:21:19 -0700 Subject: elasticsearch index alias howto --- extra/elasticsearch/README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'extra/elasticsearch') diff --git a/extra/elasticsearch/README.md b/extra/elasticsearch/README.md index 60469250..3a48a178 100644 --- a/extra/elasticsearch/README.md +++ b/extra/elasticsearch/README.md @@ -69,7 +69,22 @@ a new index and then cut over with no downtime. http put :9200/fatcat_release_v03 < release_schema.json -TODO: more docs for actual cut-over +To replace a "real" index with an alias pointer, do two actions (not truely +zero-downtime, but pretty fast): + + http delete :9200/fatcat_release + http put :9200/fatcat_release_v03/_alias/fatcat_release + +To do an atomic swap from one alias to a new one ("zero downtime"): + + http post :9200/_aliases << EOF + { + "actions": [ + { "remove": { "index": "fatcat_release_v03", "alias": "fatcat_release" }}, + { "add": { "index": "fatcat_release_v04", "alias": "fatcat_release" }} + ] + } + EOF ## Full-Text Querying -- cgit v1.2.3