[ES|QL] Add mechanism to simulate long queries#191520
Merged
lukasolson merged 1 commit intoelastic:mainfrom Aug 28, 2024
Merged
[ES|QL] Add mechanism to simulate long queries#191520lukasolson merged 1 commit intoelastic:mainfrom
lukasolson merged 1 commit intoelastic:mainfrom
Conversation
Contributor
Author
|
/ci |
lukasolson
commented
Aug 27, 2024
Comment on lines
+12
to
+26
| 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 '..'; |
Contributor
Author
There was a problem hiding this comment.
Most of this is just import optimization, the only actual change here is adding the type Filter to the import from @kbn/es-query.
Contributor
|
Pinging @elastic/kibana-visualizations (Team:Visualizations) |
Contributor
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
Contributor
|
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 |
dej611
approved these changes
Aug 28, 2024
mattkime
approved these changes
Aug 28, 2024
Contributor
mattkime
left a comment
There was a problem hiding this comment.
changes look good and work well
2 tasks
Contributor
|
Awesome Lukas |
lukasolson
added a commit
that referenced
this pull request
Aug 29, 2024
## 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:  After:  ### 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))
This file contains hidden or 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
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
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_SECONDSpattern that Lens uses.