Advanced Search 500 status code errors after 18.2 upgrade

Summary

GitLab Support has seen a number of new tickets recently regarding the upgrade to v18.2 and Advanced Search returning errors. We've been able to reproduce on self-managed by upgrading to v18.2.

When searching for the projects scope, a 500 status code error appears. In the GitLab Rails logs, we see the following exception class and message:

  "exception.class": "Elasticsearch::Transport::Transport::Errors::BadRequest",
  "exception.message": "[400] {\"error\":{\"root_cause\":[{\"type\":\"parsing_exception\",\"reason\":\"[_na] query malformed, must start with start_object\",\"line\":1,\"col\":789}],\"type\":\"x_content_parse_exception\",\"reason\":\"[1:789] [bool] failed to parse field [filter]\",\"caused_by\":{\"type\":\"x_content_parse_exception\",\"reason\":\"[1:789] [bool] failed to parse field [should]\",\"caused_by\":{\"type\":\"parsing_exception\",\"reason\":\"[_na] query malformed, must start with start_object\",\"line\":1,\"col\":789}}},\"status\":400}",

Steps to reproduce

Reproduced by GitLab Support on v18.2

  1. Enable Advanced Search on v18.0 or v18.1
  2. Index data
  3. Upgrade to v18.2
  4. Attempt to search using the default scope or projects scope

Example Project

What is the current bug behavior?

500 error is returned in the UI, and 400 error is returned by Elasticsearch

What is the expected correct behavior?

Search doesn't return error

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Patch release information for backports

If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.

Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.

High-severity bug remediation

To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.

Edited by 🤖 GitLab Bot 🤖