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
Elasticsearch: Implement modify query using a Lucene parser #71954
Conversation
BTW I will deal with the merge conflicts after the review because depending on how long it takes I might have to do it more than once otherwise. |
@gwdawson This could be a fun PR to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would like to see a couple of tests for removeNodeFromTree
but other than that, it LGTM!
i think this is a great improvement. 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to add this test related to whitespace between :
- expect(queryHasFilter('(this:"that" OR test :test) AND label:value', 'test', 'test')).toBe(true);
, but it returns false. It should return true
, right?
We need to clear up those spaces, otherwise the parser fails, so probably. Will look into it. Thanks! |
According to the parser, that is not a valid query. We can workaround it with the normalization, but maybe we shouldn't support queries written in that way. As for now, the code has been updated to support it. |
|
Backend code coverage report for PR #71954 |
Frontend code coverage report for PR #71954
|
(Open the links below in a new tab to go to the correct steps)
|
* Lucene: add dependency * ModifyQuery: use Lucene parser to detect key:values in queries * ModifyQuery: use Lucene parser to remove filters * Remove test code * Modify query: switch to recursive implementation * Modify query: implement remove filter * Update query normalizing function * FlagElasticToggleableFilters: remove feature flag * Remove unused feature flag from test * Elasticsearch: escape quotes in filter values
…71954) * Lucene: add dependency * ModifyQuery: use Lucene parser to detect key:values in queries * ModifyQuery: use Lucene parser to remove filters * Remove test code * Modify query: switch to recursive implementation * Modify query: implement remove filter * Update query normalizing function * FlagElasticToggleableFilters: remove feature flag * Remove unused feature flag from test * Elasticsearch: escape quotes in filter values
In previous PRs we improved the ability to add and remove filters in Elasticsearch using Log Details controls. Now, we're changing the regex-driven implementation to one using a Lucene parser to read and modify the query.
Additional changes:
elasticToggleableFilters
which is currently not in use, replaced withtoggleLabelsInLogsUI
which controls access to this feature.Which issue(s) does this PR fix?:
Fixes #61765
Fixes #72008
Special notes for your reviewer: