Skip to content

Index trial groups in Elasticsearch

Dylan Griffith requested to merge 220386-index-trial-groups into master

What does this MR do?

As part of #220386 (closed) we want to index trial groups in Elasticsearch so they can make use of Advanced search.

This change also refactored the existing logic around indexing paid groups a bit:

  1. Removing the feature flag that has been on for a while now along with the documentation explaining this feature flag. We already have separate docs explaining that Advanced Global Search is enabled for bronze and above groups so this is not necessary.
  2. This will now also exclude expired? groups which we shouldn't have been indexing to begin with. The assumption is that the expired? check will also ensure we skip expired trials. These expired trials also have a trial_ends_on date but based on looking at some data I think we can expect this will be the same or less than end_date. The expired trials that are in the index will be cleaned up in !38551 (merged)
  3. Don't check saved_changes.key?('hosted_plan_id') anymore since we don't really care why the plan is changing. As long as we use safe_find_or_create_by! we'll be fine to run this multiple times.

I've assumed that we don't need to check trial_ends_on since I assume it should only ever be <= end_date and I'm assuming the only reason they would be different is when someone upgrades from a trial to a full plan. The data in production mostly confirms this with only 2 cases that are different that I'm assuming is probably just bad data:

[ gprd ] production> GitlabSubscription.where("trial_ends_on IS NOT NULL AND trial_ends_on > end_date").count
=> 2
[ gprd ] production> GitlabSubscription.where("trial_ends_on IS NOT NULL AND trial_ends_on < end_date").count
=> 2099
[ gprd ] production> GitlabSubscription.where("trial_ends_on IS NOT NULL AND trial_ends_on = end_date").count
=> 12927

Screenshots

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

#220386 (closed) Closes #225744 (closed)

Edited by Dylan Griffith

Merge request reports