[go: up one dir, main page]

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
  • Add new VulnerabilityReadsESFinder class:
    • Use .by_full_text as query type
    • Use the same structure as VulnerabilityReadsFinder finder to aggregate filters that create an ES query
    • Use Search::Elastic::ResponseMapper with query to retrieve AR objects from Postgres

Testing:

  • Reuse test cases from VulnerabilityReadsFinder spec to 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