Merge lp://staging/~abentley/charmworld/migrate into lp://staging/~juju-jitsu/charmworld/trunk

Proposed by Aaron Bentley
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
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.

To post a comment you must log in.
238. By Aaron Bentley

Remove incorrect dependency of es_update on install.

Revision history for this message
j.c.sackett (jcsackett) wrote :

Aaron, this looks great. I have no substantial comments, but would note that "incompatible" is misspelled at #64 below.

review: Approve
239. By Aaron Bentley

Fix speling

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches