Search autocomplete for recent items is timing out

Summary

It was noticed on GitLab.com that search autocomplete is not returning recent items. It should return recent merge requests and issues for the search terms typed into the top search bar

Steps to reproduce

  1. open up devtools
  2. open up gitlab.com
  3. type any text (example: test) into the search gitlab bar on the top left
  4. verify in devtools that the call to https://gitlab.com/search/autocomplete?term=test&filter=generic times out with a 408 response

Relevant logs and/or screenshots

kibana (internal link) and sentry (internal link) show the issue starting about 2022-10-26

Click to expand

image

Possible fixes

the code for tracking recent items shows that we track 100 items per user. Perhaps too many items are being tracked per user, I'm not sure. The timeouts are occurring in the Issues and MergeRequests tables which are large, active tables