Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor search filters #11477

Open
2 tasks
bferguso opened this issue Sep 19, 2024 · 1 comment · May be fixed by #11481
Open
2 tasks

Refactor search filters #11477

bferguso opened this issue Sep 19, 2024 · 1 comment · May be fixed by #11481
Assignees

Comments

@bferguso
Copy link
Contributor

As part of the PR #10999 disucssion, the group identified that the search filter logic should be refactored, and the es_mapping_modifier hook be applied to all search filters, not just the search_term filter. Time constraints stopped these changes from targeting version 7.6.x so it was decided to target 8.0.x for these changes.

Currently the append_dsl method does several things:

  1. Create the DSL
  2. Apply the es_mapping_modifier.add_search_filter method if it is configured
  3. Appends the resultant DSL to the search_query_object

It was determined that these 3 steps should be broken into separate methods within each search filter to allow individual parts of the logic to be overriden. Also, the add_search_filter call should be added to the remaining filters.

High level tasks for this are:

  • Refactor the search filter pattern to break the above steps into 3 distinct parts
  • Modify the es_mapping_modifier.add_search_filter such that it has the conext from which it is being called (eg what filter type is calling it - term_filter, time_filter, etc)

The PR should target version dev/8.0.x

@bferguso bferguso self-assigned this Sep 19, 2024
@chiatt chiatt added this to pipeline Sep 19, 2024
@whatisgalen
Copy link
Member

Just to add to this, from a high level:

the append_dsl method on a search filter not only appends dsl to a query object, it generates the dsl according to the logic of the search filter. Given these two distinct functionalities and that the dsl is essentially immutable after it's added to the query object, we proposed that one method generate_dsl be created for a search filter's logic, leaving the append_dsl method to do what its name implies: check for custom index mapping hooks to further modify the dsl, then finally add the dsl to the main query object.

@whatisgalen whatisgalen linked a pull request Sep 20, 2024 that will close this issue
10 tasks
@whatisgalen whatisgalen linked a pull request Sep 20, 2024 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

2 participants