[main] Fix an OOM error when creating to many chained synonym graph token filter. (#140026)#8
Conversation
…lter. (elastic#140026) * Create YAML REST test for chained synonym filters. * Adding some unit tests for chained synonyms graph filters creation. * Ensure previous synonyms set from the chain aren't applied again. (cherry picked from commit e6bd70d)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aaa34f284
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // | ||
| // This matches the behavior of SynonymTokenFilterFactory and prevents OOM with chained | ||
| // synonym filters (critical for users with many chained synonym sets). | ||
| return this; |
There was a problem hiding this comment.
Return identity filter for synonym parsing
In chained synonym_graph setups, buildSynonymAnalyzer(...) (in SynonymTokenFilterFactory) builds the synonym parser analyzer by calling getSynonymFilter() on previous filters. Returning this here keeps prior synonym_graph filters active, so synonym rules for later filters are still expanded by earlier filters, recreating the recursive expansion/large SynonymMap problem the change is meant to prevent. This means the OOM scenario with multiple chained synonym_graph filters can still occur. Consider returning IDENTITY_FILTER (as SynonymTokenFilterFactory does) or otherwise disabling synonym_graph filters during synonym parsing.
Useful? React with 👍 / 👎.
Benchmark PR from qodo-benchmark#68