Vulnerability Reads Finder with ES
We need to create a new VulnerabilityReadsESFinder class that uses Elasticsearch instead of PostgreSQL while supporting all filters currently available in VulnerabilityReadsFinder \
Implementation plan:
- Add a new ES Vulnerability filter class
ee/lib/search/elastic/vulnerabilities_filters.rb- Build on existing ES filter classes to reuse functionality like
by_search_level_and_membership - Implement all filters that correspond to those in
VulnerabilityReadsFinder
- Build on existing ES filter classes to reuse functionality like
- Add new
VulnerabilityReadsESFinderclass:- Use
.by_full_textas query type - Use the same structure as
VulnerabilityReadsFinderfinder to aggregate filters that create an ES query - Use Search::Elastic::ResponseMapper with query to retrieve AR objects from Postgres
- Use
Testing:
- Reuse test cases from
VulnerabilityReadsFinder specto ensure consistent behavior - Enable Elasticsearch in tests with
stub_ee_application_setting(elasticsearch_search: true, elasticsearch_indexing: true)this ensures that when Vulnerability objects are created in the Postgres test DB, the Elasticsearch index will be properly populated
Edited by Schmil Monderer