Search query builder formatter
What does this MR do and why?
Adds a format class which has two methods currently:
-
size
: set to 0 ifcount_only
is true -
source_fields
: sets_source
to fields defined in options - from Only return ID from Elasticsearch response for ... (!152905 - merged)
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
Compare the queries between the class proxy and query builder to see they're the same:
Search::Elastic::IssueQueryBuilder.build(query: '*')
is the same as
Issue.__elasticsearch__.elastic_search('*').search.definition[:body]
With count_only: true
:
Search::Elastic::IssueQueryBuilder.build(query: '*', options: {count_only: true})
is the same as
Issue.__elasticsearch__.elastic_search('*', options: {count_only: true}).search.definition[:body]
Related to #461872 (closed)
Edited by Madelein van Niekerk