Skip to content

Only return ID from Elasticsearch response for issues

Madelein van Niekerk requested to merge 454249-only-return-id into master

What does this MR do and why?

When doing an Elasticsearch search using ApplicationClassProxy, the response from ES contains the full source from every document. We find the corresponding database record using the id extracted in ee/lib/gem_extensions/elasticsearch/model/response/records.rb:

def ids
  response.response['hits']['hits'].map { |hit| hit['_source']['id'] }
end

Therefore we don't need to return the full source and can instead only return the id.

All scopes except for blobs, wikis and commits don't need the full source to be returned so we could pass an option to decide whether or not the source should be returned but to keep it simple, I've opted to only disable source for issues because with the introduction of embeddings, it would be expensive and unnecessary to return 768 floats for every document.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

  1. Perform normal searches and note that it continues to function as-is

Related to #454249

Edited by Madelein van Niekerk

Merge request reports