Add blob search aggregations for language

Merged Terri Chu requested to merge 340333-add-language-aggregations-for-blob-search into master

What does this MR do and why?

Related to Epic: &6853 Issue: #342642 (closed)

This adds aggregations to the Elasticsearch query (used by Advanced Search) for blob searches only. Aggregations will not be included when count_only searches are being run (used for the count tabs at the top of the search results page).

We have done some benchmarking (see related issue) but want to release behind a feature flag (search_blobs_language_aggregation) to be able to quickly roll back in performance is impacted. The feature flag will be rolled out using user actors via: #342621

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Enable the feature flag for the user you are logging into gdk with: Feature.enable(:search_blobs_language_aggregation, user)
  2. Run a code search (global, group or project level - it does not matter which)
  3. Verify that the aggregations show up in the performance bar for the blob search (what you are looking for is the aggs section in the JSON request to Elasticsearch, near the bottom) image
  4. Verify that aggregations do not show up in the performance bar for the other count queries image
  5. Run a non-code search
  6. Verify that aggregations do not show up in the performance bar for the search image
  7. Verify that aggregations do not show up in the performance bar for the blobs count image

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Terri Chu