-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite
indices
query in the format migrator
The format migrator prevents users from getting duplicate results when formats are migrated into the "govuk" index from the "government" or "detailed" ones: it ensures that only non-migrated formats are returned from the "government"/"detailed" indices and only migrated formats are returned from the "govuk" index. Previously it did this with an `indices` query. They look like this: { indices: { indices: ["list", "of", "indices"] , query: { query to perform against docs from the indices } , no_match_query: { query to perform against other docs } } } However, the `indices` query has been deprecated in ES5 and removed in ES6, in favour of just searching over the `_index` field in docs directly. This PR changes the `indices` query into a `should` with two clauses where one clause matches documents in the "govuk" index and the other clause matches documents in the other indices. It's a bit more cumbersome because the `terms` query I'm using doesn't handle index aliases[1], and involves another round-trip to elasticsearch when constructing the query to find out the real name of the "govuk" alias. Index real names only change very infrequently (whenever we reindex the cluster), so in principle they could be cached. But we don't currently have a good way for the reindexing rake task to signal to the web processes that they need to purge their cache. [1] elastic/elasticsearch#23306
- Loading branch information
Showing
5 changed files
with
138 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters