-
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
[search source] remove is_partial check #164506
Conversation
…-ref HEAD~1..HEAD --fix'
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
`data.search` uses [poll_search](https://github.com/elastic/kibana/blob/main/src/plugins/data/common/search/poll_search.ts) to fetch data. `poll_search` checks for `isErrorResponse` and throws when`isErrorResponse` is true. **Note** `searchSource.search` uses `data.search` to perform searches. ```javascript return from(search()).pipe( expand(() => { const elapsedTime = Date.now() - startTime; return timer(getPollInterval(elapsedTime)).pipe(switchMap(search)); }), tap((response) => { if (isErrorResponse(response)) { throw response ? new Error('Received partial response') : new AbortError(); } }), takeWhile<Response>(isPartialResponse, true), takeUntil<Response>(aborted$) ); ``` Subscribers to `data.search` and `searchSource.search` do not need to check for `isErrorResponse` in `next`. `poll_search` has already thrown then the response is `isErrorResponse` so these checks are dead code blocks that are never executed. This PR removes these dead code blocks. Breaking this change out of #164506 so that it can be reviewed in isolated. --------- Co-authored-by: kibanamachine <[email protected]>
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
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.
ent-search changes LGTM
Pinging @elastic/uptime (Team:uptime) |
@elasticmachine merge upstream |
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.
AIOps changes LGTM
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.
Added a couple of minor comments below, overall LGTM!
src/plugins/data/public/search/search_interceptor/search_interceptor.test.ts
Show resolved
Hide resolved
src/plugins/data/public/search/search_interceptor/search_response_cache.test.ts
Outdated
Show resolved
Hide resolved
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 Visualizations team review was asked due to co-ownership with the discovery team. Lukas approval will be enough to allow merging as all changes are search related and the discovery team owns them 👍
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.
LGTM for the Protections Experience and the Threat Hunting Investigations teams!
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
Closes #164893
Background
"is partial" has 2 meanings
async search defines 2 flags.
is_running
: Whether the search is still being executed or it has completedis_partial
: When the query is no longer running, indicates whether the search failed or was successfully completed on all shards. While the query is being executed, is_partial is always set to truenote: there is a bug in async search where requests to only local clusters return
is_partial:false
when there are shard errors on the local cluster. See async search returns is_partial:false when local cluster has shard errors elasticsearch#98725. This should be resolved in 8.11Kibana's existing search implementation does not align with Elasticsearch's
is_running
andis_partial
flags. Kibana defines "is partial" as definition "1)". Elasticsearch async search defines "is partial" as definition "2)".This PR aligns Kibana's usage of "is partial" with Elasticsearch's definition. This required the following changes
isErrorResponse
renamed toisAbortedResponse
. Method no longer returns true when!response.isRunning && !!response.isPartial
. Kibana handles results with incomplete data. Note removed export ofisErrorResponse
from data plugin since its use outside of data plugin does not make sense.isPartialResponse
withisRunningResponse
. This aligns Kibana's definition with Elasticsearch async search flags.isCompleteResponse
. The word "complete" is ambiguous. Does it mean the search is finished (no longer running)? Or does it mean the search has all results and there are no shard failures?