-
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
[ES|QL] Add mechanism to simulate long queries #191520
Conversation
/ci |
import type { | ||
IKibanaSearchRequest, | ||
IKibanaSearchResponse, | ||
ISearchGeneric, | ||
} from '@kbn/search-types'; | ||
import type { Datatable, ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; | ||
import { RequestAdapter } from '@kbn/inspector-plugin/common'; | ||
import { getStartEndParams } from '@kbn/esql-utils'; | ||
|
||
import { zipObject } from 'lodash'; | ||
import { Observable, defer, throwError } from 'rxjs'; | ||
import { catchError, map, switchMap, tap } from 'rxjs'; | ||
import { buildEsQuery } from '@kbn/es-query'; | ||
import type { ISearchGeneric } from '@kbn/search-types'; | ||
import type { ESQLSearchResponse, ESQLSearchParams } from '@kbn/es-types'; | ||
import { catchError, defer, map, Observable, switchMap, tap, throwError } from 'rxjs'; | ||
import { buildEsQuery, type Filter } from '@kbn/es-query'; | ||
import type { ESQLSearchParams, ESQLSearchResponse } from '@kbn/es-types'; | ||
import { getEsQueryConfig } from '../../es_query'; | ||
import { getTime } from '../../query'; | ||
import { ESQL_ASYNC_SEARCH_STRATEGY, KibanaContext, ESQL_TABLE_TYPE } from '..'; | ||
import { ESQL_ASYNC_SEARCH_STRATEGY, ESQL_TABLE_TYPE, KibanaContext } from '..'; |
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.
Most of this is just import optimization, the only actual change here is adding the type Filter
to the import from @kbn/es-query
.
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
Pinging @elastic/kibana-esql (Team:ESQL) |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: cc @lukasolson |
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.
changes look good and work well
Awesome Lukas |
## Summary Requires #191520. Resolves #188266. Prior to this PR, when polling on an async ES|QL request, we would log the response to every polling request. This PR only logs when the request is complete. Before: ![image](https://github.com/user-attachments/assets/fe9a763d-ef43-4f46-a096-0e08e1805f47) After: ![image](https://github.com/user-attachments/assets/5d59f016-8b0e-4a3f-b044-17b5de97739f) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed ([build](https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/6823))
Summary
Adds a mechanism to simulate a long-running query in ES|QL.
Elasticsearch provides a query type,
error_query
, in snapshot builds that allows passing a delay to simulate long-running queries. This PR adds a way to utilize this for testing & debugging purposes.To use: In your browser console, simply execute the following:
This will cause search requests to pause for 5 seconds (on each shard). This can then be used in testing & debugging.
It should be noted that this is similar in pattern to the existing
window.ELASTIC_LENS_DELAY_SECONDS
pattern that Lens uses.