-
Notifications
You must be signed in to change notification settings - Fork 25k
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
EQL: add support for partial shard results #116388
Changes from 23 commits
4aa4a97
95f9a1b
d14c1f6
b72fd37
a86ab6a
18cfa60
8777fc8
4e63b3c
b6501cc
f052782
3e5439e
90fc499
35eb31e
b003c1c
8978a01
4c421c0
2ab3972
3ab9740
8207ea0
f3a1a65
c54a0c5
a8f5fb5
fcfa021
706935c
545e614
32a7aef
1e97b85
1da924c
3ebacb8
ed6b9a7
9f9eba8
7efff36
045d8da
672e512
e1e83a6
625acf4
7f36a69
984fe02
a1c903f
f58fd1c
3aba03a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 116388 | ||
summary: Add support for partial shard results | ||
area: EQL | ||
type: enhancement | ||
issues: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2453,7 +2453,7 @@ public static void afterClass() throws Exception { | |
/** | ||
* After the cluster is stopped, there are a few netty threads that can linger, so we make sure we don't leak any tasks on them. | ||
*/ | ||
static void awaitGlobalNettyThreadsFinish() throws Exception { | ||
public static void awaitGlobalNettyThreadsFinish() throws Exception { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't find an obvious reason for this change. Can you shed some light, please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a leftover, I don't need it anymore. Reverting |
||
// Don't use GlobalEventExecutor#awaitInactivity. It will waste up to 1s for every call and we expect no tasks queued for it | ||
// except for the odd scheduled shutdown task. | ||
assertBusy(() -> assertEquals(0, GlobalEventExecutor.INSTANCE.pendingTasks())); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -478,3 +478,34 @@ setup: | |
query: 'sequence with maxspan=10d [network where user == "ADMIN"] ![network where used == "SYSTEM"]' | ||
- match: { error.root_cause.0.type: "verification_exception" } | ||
- match: { error.root_cause.0.reason: "Found 1 problem\nline 1:75: Unknown column [used], did you mean [user]?" } | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe in this or a new yml file to add the more varied scenarios for "failed shards" queries that I mentioned above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added more cases to toml tests |
||
|
||
--- | ||
"Execute query with allow_partial_search_results": | ||
- do: | ||
eql.search: | ||
index: eql_test | ||
body: | ||
query: 'process where user == "SYSTEM"' | ||
fields: [{"field":"@timestamp","format":"epoch_millis"},"id","valid","day_of_week"] | ||
allow_partial_search_results: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vary the placement of the parameter as a request parameter as well, not only the body of the request. |
||
|
||
- match: {timed_out: false} | ||
- match: {hits.total.value: 3} | ||
- match: {hits.total.relation: "eq"} | ||
- match: {hits.events.0._source.user: "SYSTEM"} | ||
- match: {hits.events.0._id: "1"} | ||
- match: {hits.events.0.fields.@timestamp: ["1580733296000"]} | ||
- match: {hits.events.0.fields.id: [123]} | ||
- match: {hits.events.0.fields.valid: [false]} | ||
- match: {hits.events.0.fields.day_of_week: ["Monday"]} | ||
- match: {hits.events.1._id: "2"} | ||
- match: {hits.events.1.fields.@timestamp: ["1580819696000"]} | ||
- match: {hits.events.1.fields.id: [123]} | ||
- match: {hits.events.1.fields.valid: [true]} | ||
- match: {hits.events.1.fields.day_of_week: ["Tuesday"]} | ||
- match: {hits.events.2._id: "3"} | ||
- match: {hits.events.2.fields.@timestamp: ["1580906096000"]} | ||
- match: {hits.events.2.fields.id: [123]} | ||
- match: {hits.events.2.fields.valid: [true]} | ||
- match: {hits.events.2.fields.day_of_week: ["Wednesday"]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would be good to have a test with a simulated shard failure to see that it gets printed out in the response. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we simulate shard failures in yaml tests? Do you have an example? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can certainly cause shard failures, for instance by querying multiple indices, out of which one returns an error for the query. Can be simple mapping related issues like a type conflict etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll have to play with it a bit; probably mapping related problems are not the way, since EQL does quite some pre-analysis based on field_caps before running the search queries, so this kind of problems will result in an early validation exception. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a few more tests here, simulating shard failures with painless. |
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.
The ES search API supports partial results for async search as well, if I read the documentation correctly. Is there something stopping us for doing the same with EQL?
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 think when _search docs mention partial results at the beginning of the page, they refer to something slightly different, ie. the first part of a response that is still being calculated.
Search results can also be partial because of missing shards, that is the same we have in EQL, regardless of the request being sync or async.
This said, we definitely need some tests for async EQL queries with
allow_partial_search_results=true
. I'm adding them.