freelawproject / courtlistener

A fully-searchable and accessible archive of court data including growing repositories of opinions, oral arguments, judges, judicial financial records, and federal filings.
https://www.courtlistener.com
Other
550 stars 151 forks source link

Final switch to ElasticSearch from Solr #4713

Open mlissner opened 1 day ago

mlissner commented 1 day ago

We promised that we'd deprecate the Solr version of v3 of the API and webhooks on November 25th.

In #4650, we learned that a brown out strategy should be pretty easy, so this ticket is to discuss the full profess we need to do on Monday and through the end of the week.

There are three waffle flags that we need to flip:

By Friday when this is done, Solr can probably be turned off. We'll see. Alberto, can you please chime in with the details and pieces I've missed about this?

albertisfu commented 10 hours ago

By Friday when this is done, Solr can probably be turned off. We'll see. Alberto, can you please chime in with the details and pieces I've missed about this?

Sure, here are some details about this process.

Switch V3 of RECAP Search API to ES

To begin serving requests via ES, we can set the flag r-es-search-api-active to 5% on Monday. r-es-search-api-active

Breaking changes outlined in the migration guide for type=r will begin applying to requests randomly, based on the percentage set.

Switch V3 of Opinion Search API to ES

This process should follow these steps:

manage.py clean_up_search_alerts --action validate-queries --validation-wait 1

If errors are found, they are likely to involve syntax issues, such as unbalanced quotes, parentheses, or invalid characters in ES queries. We expect only a few errors, which can be manually reviewed and corrected in the admin interface.

If we have time it'd be a good idea to run this command before Monday in order to estimate the manual effort required. If many alerts share common issues, we could potentially write a script to fix them in bulk.

After fixes are in place we should run the command again to confirm all its correct now.

If no errors remain, then we'll need to execute the following command to replace the stat_ filter in current alerts with the new values for ES:

manage.py clean_up_search_alerts --action clean-up

Immediately after making this change, enable the following flag and switch for everyone:

o-es-active o-es-alerts-active

So the Opinion Search frontend and also Opinion Search Alerts start working with ES.

Something to consider is that when we turn enable o-es-active it'll start using ES will be used to query Related Cases on the Opinions page and we still need to verify that this functionality works correctly or apply any necessary tweaks, as planned in Issue #4305.

However I think this issue is planned for next sprint? If so we could introduce a separate flag now to ensure this feature isn't enabled when o-es-active is turned enabled for other frontend functionalities.

Finally, set a percentage for the o-es-search-api-active flag to start serving V3 Opinion Search Alert API requests via ES.