mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Fixes the error in the console (#198307)](https://github.com/elastic/kibana/pull/198307) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Stratoula Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2024-11-01T10:49:07Z","message":"[ES|QL] Fixes the error in the console (#198307)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/198258\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>","sha":"c31906085024e2ae3b7a34f6b3bc80f40da9d514","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.17.0"],"title":"[ES|QL] Fixes the error in the console","number":198307,"url":"https://github.com/elastic/kibana/pull/198307","mergeCommit":{"message":"[ES|QL] Fixes the error in the console (#198307)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/198258\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>","sha":"c31906085024e2ae3b7a34f6b3bc80f40da9d514"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198307","number":198307,"mergeCommit":{"message":"[ES|QL] Fixes the error in the console (#198307)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/198258\r\n\r\n### Checklist\r\n\r\n- [ ] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>","sha":"c31906085024e2ae3b7a34f6b3bc80f40da9d514"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
parent
d74f8a796d
commit
52f7e2b48e
4 changed files with 28 additions and 5 deletions
|
@ -682,6 +682,7 @@ export interface ESQLSearchResponse {
|
|||
all_columns?: ESQLColumn[];
|
||||
values: ESQLRow[];
|
||||
took?: number;
|
||||
_clusters?: estypes.ClusterStatistics;
|
||||
}
|
||||
|
||||
export interface ESQLSearchParams {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
import { estypes } from '@elastic/elasticsearch';
|
||||
import type { Start as InspectorStartContract } from '@kbn/inspector-plugin/public';
|
||||
import type { ESQLSearchResponse } from '@kbn/es-types';
|
||||
import type { RequestAdapter } from '@kbn/inspector-plugin/common/adapters/request';
|
||||
import { extractWarnings } from './extract_warnings';
|
||||
|
||||
|
@ -108,6 +109,22 @@ describe('extract search response warnings', () => {
|
|||
|
||||
expect(warnings).toEqual([]);
|
||||
});
|
||||
|
||||
it('should not include warnings when there is no _clusters or _shards information', () => {
|
||||
const warnings = extractWarnings(
|
||||
{
|
||||
took: 46,
|
||||
all_columns: [{ name: 'field1', type: 'string' }],
|
||||
columns: [{ name: 'field1', type: 'string' }],
|
||||
values: [['value1']],
|
||||
} as ESQLSearchResponse,
|
||||
mockInspectorService,
|
||||
mockRequestAdapter,
|
||||
'My request'
|
||||
);
|
||||
|
||||
expect(warnings).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('remote clusters', () => {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
|
||||
import { estypes } from '@elastic/elasticsearch';
|
||||
import type { ESQLSearchResponse } from '@kbn/es-types';
|
||||
import type { Start as InspectorStartContract, RequestAdapter } from '@kbn/inspector-plugin/public';
|
||||
import type { SearchResponseWarning } from './types';
|
||||
|
||||
|
@ -15,7 +16,7 @@ import type { SearchResponseWarning } from './types';
|
|||
* @internal
|
||||
*/
|
||||
export function extractWarnings(
|
||||
rawResponse: estypes.SearchResponse,
|
||||
rawResponse: estypes.SearchResponse | ESQLSearchResponse,
|
||||
inspectorService: InspectorStartContract,
|
||||
requestAdapter: RequestAdapter,
|
||||
requestName: string,
|
||||
|
@ -23,11 +24,13 @@ export function extractWarnings(
|
|||
): SearchResponseWarning[] {
|
||||
const warnings: SearchResponseWarning[] = [];
|
||||
|
||||
// ES|QL supports _clusters in case of CCS but doesnt support _shards and timed_out (yet)
|
||||
const isPartial = rawResponse._clusters
|
||||
? rawResponse._clusters.partial > 0 ||
|
||||
rawResponse._clusters.skipped > 0 ||
|
||||
rawResponse._clusters.running > 0
|
||||
: rawResponse.timed_out || rawResponse._shards.failed > 0;
|
||||
: ('timed_out' in rawResponse && rawResponse.timed_out) ||
|
||||
('_shards' in rawResponse && rawResponse._shards.failed > 0);
|
||||
if (isPartial) {
|
||||
warnings.push({
|
||||
type: 'incomplete',
|
||||
|
@ -39,9 +42,10 @@ export function extractWarnings(
|
|||
status: 'partial',
|
||||
indices: '',
|
||||
took: rawResponse.took,
|
||||
timed_out: rawResponse.timed_out,
|
||||
_shards: rawResponse._shards,
|
||||
failures: rawResponse._shards.failures,
|
||||
timed_out: 'timed_out' in rawResponse && rawResponse.timed_out,
|
||||
...('_shards' in rawResponse
|
||||
? { _shards: rawResponse._shards, failures: rawResponse._shards.failures }
|
||||
: {}),
|
||||
},
|
||||
},
|
||||
openInInspector: () => {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"@kbn/core",
|
||||
"@kbn/react-kibana-mount",
|
||||
"@kbn/core-i18n-browser",
|
||||
"@kbn/es-types",
|
||||
],
|
||||
"exclude": ["target/**/*"]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue