-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Security Solution] [Detections] Combine multiple timestamp searches into single request #95723
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
💔 Build Failed
Failed CI Steps
Test FailuresKibana Pipeline / jest / Jest Tests.x-pack/plugins/security_solution/server/lib/detection_engine/signals.create_signals it builds a now-5m up to today filterStandard Out
Stack Trace
Kibana Pipeline / jest / Jest Tests.x-pack/plugins/security_solution/server/lib/detection_engine/signals.create_signals if searchAfterSortId is an empty string it should not be includedStandard Out
Stack Trace
Kibana Pipeline / jest / Jest Tests.x-pack/plugins/security_solution/server/lib/detection_engine/signals.create_signals if searchAfterSortId is a valid sortId stringStandard Out
Stack Trace
and 8 more failures, only showing the first 3. Metrics [docs]
To update your PR or re-run it, just comment with: |
implementing without |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Related issues: elastic/elasticsearch-specification#267
Background
Initial implementation of the ability for rules to query against documents using multiple timestamps resulted in two single search afters being sent in series.
Research
There was some investigation into combining these sort fields into one query so that we do not need to make two separate search requests. The problem with this combination is we need to query documents that use the
timestamp override
field and simultaneously query documents that do not have the timestamp override field.To execute this same query in a single request we would need the ability to execute the query using two sort fields where the query has an XOR (query with
timestamp override
field XOR query with@timestamp
field and documents do not have thetimestamp override
field.)Proposed solution
Looking into this I feel that the better option (and maybe only option since I have not found a way in Elasticsearch DSL to execute an XOR filter with sorting) is to utilize the
msearch
api. This supportssearch_after
and allows us to send one single request while keeping the searches logically separated.The
msearch
api could benefit rules that require executing the same query with different params such as threat indicator rules but this is out of scope for this PR.Checklist
Delete any items that are not applicable to this PR.
For maintainers