Merge lp://staging/~abentley/charmworld/migrate into lp://staging/~juju-jitsu/charmworld/trunk
Status: | Merged |
---|---|
Approved by: | Aaron Bentley |
Approved revision: | 239 |
Merged at revision: | 223 |
Proposed branch: | lp://staging/~abentley/charmworld/migrate |
Merge into: | lp://staging/~juju-jitsu/charmworld/trunk |
Diff against target: |
502 lines (+317/-45) 5 files modified
Makefile (+8/-1) charmworld/search.py (+175/-40) charmworld/testing/__init__.py (+8/-4) charmworld/tests/test_search.py (+125/-0) setup.py (+1/-0) |
To merge this branch: | bzr merge lp://staging/~abentley/charmworld/migrate |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
j.c.sackett (community) | Approve | ||
Review via email: mp+162373@code.staging.launchpad.net |
Commit message
Add script to update ElasticSearch.
Description of the change
Implement ElasticSearch migration functionality. This switches indexing to a new approach where the main index is actually an alias, and the real index is has a random name.
A new script, 'es-update' will create or update the current charm index. When an incompatibility is detected (i.e. put-mapping pukes), a new random-named index is created with the new mapping, the old index is copied into it, and the alias is swapped so that the new index becomes the sole alias. (The outcome is basically the same if the 'charms' index was a real index, not an alias.)
We normally want to access indices with the alias name, but we want to create them with random names, so ensure_index is no longer an appropriate method. It is simplified to create_index.
Using aliases meant that the lookups formerly done by api_search were no longer appropriate, so _unlimited_search was implemented.
put_mapping was extracted from index_charm so that it is called only when needed, not every time a charm is indexed.
Aaron, this looks great. I have no substantial comments, but would note that "incompatible" is misspelled at #64 below.