-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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 Sessions] Improve search session errors #88613
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
e140045
Detect ESError correctly
738b8a1
fix tests and improve types
7f94977
type
cdf80e2
normalize search error response format for search and bsearch
6203a02
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
5e3eb1f
type
f57c316
Added es search exception examples
883fd9f
Normalize and validate errors thrown from oss es_search_strategy
07d0f7d
Added tests for search service error handling
f1ef0c4
Update msearch tests to test for errors
20fff53
Moved bsearch route to routes folder
f562140
Align painless error object
f99eb8a
eslint
e74b40d
Add to seach interceptor tests
bca6410
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
41a6efa
add json to tsconfig
57d35a0
docs
1e0baaf
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
38ad50f
updated xpack search strategy tests
a99819c
oops
1dfaedd
license header
4d1dee4
Add test for xpack painless error format
fa61816
doc
467093f
Merge branch 'master' into sessions/error-format
kibanamachine a1897b4
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
fa43857
Fix bsearch test potential flakiness
1a55ee7
Merge branch 'sessions/error-format' of github.com:lizozom/kibana int…
5386121
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
ddf41b8
Merge branch 'master' into sessions/error-format
kibanamachine aefb581
Merge branch 'sessions/error-format' of github.com:lizozom/kibana int…
8da2936
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
582d76c
Merge branch 'master' into sessions/error-format
kibanamachine 48a44b4
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
237ed01
code review
f3f3a84
Merge branch 'sessions/error-format' of github.com:lizozom/kibana int…
f74e58b
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
edaa188
fix
e6648a1
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
1435ec1
Merge branch 'master' into sessions/error-format
kibanamachine 434fc62
code review 2
7c94fe0
Merge branch 'sessions/error-format' of github.com:lizozom/kibana int…
244a93b
Merge branch 'master' into sessions/error-format
kibanamachine 6057ece
Merge branch 'master' into sessions/error-format
kibanamachine b6950d2
Merge branch 'master' into sessions/error-format
kibanamachine 7d7fca5
Merge branch 'master' of github.com:elastic/kibana into sessions/erro…
98a1bb4
Merge branch 'sessions/error-format' of github.com:lizozom/kibana int…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
14 changes: 14 additions & 0 deletions
14
src/plugins/data/common/search/test_data/illegal_argument_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "illegal_argument_exception", | ||
"reason" : "failed to parse setting [timeout] with value [1] as a time value: unit is missing or unrecognized" | ||
} | ||
], | ||
"type" : "illegal_argument_exception", | ||
"reason" : "failed to parse setting [timeout] with value [1] as a time value: unit is missing or unrecognized" | ||
}, | ||
"status" : 400 | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
src/plugins/data/common/search/test_data/index_not_found_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "index_not_found_exception", | ||
"reason" : "no such index [poop]", | ||
"resource.type" : "index_or_alias", | ||
"resource.id" : "poop", | ||
"index_uuid" : "_na_", | ||
"index" : "poop" | ||
} | ||
], | ||
"type" : "index_not_found_exception", | ||
"reason" : "no such index [poop]", | ||
"resource.type" : "index_or_alias", | ||
"resource.id" : "poop", | ||
"index_uuid" : "_na_", | ||
"index" : "poop" | ||
}, | ||
"status" : 404 | ||
} |
14 changes: 14 additions & 0 deletions
14
src/plugins/data/common/search/test_data/json_e_o_f_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "json_e_o_f_exception", | ||
"reason" : "Unexpected end-of-input: expected close marker for Object (start marker at [Source: (org.elasticsearch.common.io.stream.InputStreamStreamInput); line: 1, column: 1])\n at [Source: (org.elasticsearch.common.io.stream.InputStreamStreamInput); line: 1, column: 2]" | ||
} | ||
], | ||
"type" : "json_e_o_f_exception", | ||
"reason" : "Unexpected end-of-input: expected close marker for Object (start marker at [Source: (org.elasticsearch.common.io.stream.InputStreamStreamInput); line: 1, column: 1])\n at [Source: (org.elasticsearch.common.io.stream.InputStreamStreamInput); line: 1, column: 2]" | ||
}, | ||
"status" : 400 | ||
} | ||
|
17 changes: 17 additions & 0 deletions
17
src/plugins/data/common/search/test_data/parsing_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "parsing_exception", | ||
"reason" : "[terms] query does not support [ohno]", | ||
"line" : 4, | ||
"col" : 17 | ||
} | ||
], | ||
"type" : "parsing_exception", | ||
"reason" : "[terms] query does not support [ohno]", | ||
"line" : 4, | ||
"col" : 17 | ||
}, | ||
"status" : 400 | ||
} |
13 changes: 13 additions & 0 deletions
13
src/plugins/data/common/search/test_data/resource_not_found_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "resource_not_found_exception", | ||
"reason" : "FlZlSXp6dkd3UXdHZjhsalVtVHBnYkEdYjNIWDhDOTZRN3ExemdmVkx4RXNQQToxMjc2ODk=" | ||
} | ||
], | ||
"type" : "resource_not_found_exception", | ||
"reason" : "FlZlSXp6dkd3UXdHZjhsalVtVHBnYkEdYjNIWDhDOTZRN3ExemdmVkx4RXNQQToxMjc2ODk=" | ||
}, | ||
"status" : 404 | ||
} |
52 changes: 52 additions & 0 deletions
52
src/plugins/data/common/search/test_data/search_phase_execution_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "script_exception", | ||
"reason" : "compile error", | ||
"script_stack" : [ | ||
"invalid", | ||
"^---- HERE" | ||
], | ||
"script" : "invalid", | ||
"lang" : "painless", | ||
"position" : { | ||
"offset" : 0, | ||
"start" : 0, | ||
"end" : 7 | ||
} | ||
} | ||
], | ||
"type" : "search_phase_execution_exception", | ||
"reason" : "all shards failed", | ||
"phase" : "query", | ||
"grouped" : true, | ||
"failed_shards" : [ | ||
{ | ||
"shard" : 0, | ||
"index" : ".kibana_11", | ||
"node" : "b3HX8C96Q7q1zgfVLxEsPA", | ||
"reason" : { | ||
"type" : "script_exception", | ||
"reason" : "compile error", | ||
"script_stack" : [ | ||
"invalid", | ||
"^---- HERE" | ||
], | ||
"script" : "invalid", | ||
"lang" : "painless", | ||
"position" : { | ||
"offset" : 0, | ||
"start" : 0, | ||
"end" : 7 | ||
}, | ||
"caused_by" : { | ||
"type" : "illegal_argument_exception", | ||
"reason" : "cannot resolve symbol [invalid]" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"status" : 400 | ||
} |
17 changes: 17 additions & 0 deletions
17
src/plugins/data/common/search/test_data/x_content_parse_exception.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"error" : { | ||
"root_cause" : [ | ||
{ | ||
"type" : "x_content_parse_exception", | ||
"reason" : "[5:13] [script] failed to parse object" | ||
} | ||
], | ||
"type" : "x_content_parse_exception", | ||
"reason" : "[5:13] [script] failed to parse object", | ||
"caused_by" : { | ||
"type" : "json_parse_exception", | ||
"reason" : "Unexpected character (''' (code 39)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (org.elasticsearch.common.bytes.AbstractBytesReference$BytesReferenceStreamInput); line: 5, column: 24]" | ||
} | ||
}, | ||
"status" : 400 | ||
} |
This file contains 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
This file contains 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
This file contains 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
42 changes: 42 additions & 0 deletions
42
src/plugins/data/public/search/errors/painless_error.test.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import { coreMock } from '../../../../../core/public/mocks'; | ||
const startMock = coreMock.createStart(); | ||
|
||
import { mount } from 'enzyme'; | ||
import { PainlessError } from './painless_error'; | ||
import { findTestSubject } from '@elastic/eui/lib/test'; | ||
import * as searchPhaseException from '../../../common/search/test_data/search_phase_execution_exception.json'; | ||
|
||
describe('PainlessError', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('Should show reason and code', () => { | ||
const e = new PainlessError({ | ||
statusCode: 400, | ||
message: 'search_phase_execution_exception', | ||
attributes: searchPhaseException.error, | ||
}); | ||
const component = mount(e.getErrorMessage(startMock.application)); | ||
|
||
const scriptElem = findTestSubject(component, 'painlessScript').getDOMNode(); | ||
|
||
const failedShards = e.attributes?.failed_shards![0]; | ||
const script = failedShards!.reason.script; | ||
expect(scriptElem.textContent).toBe(`Error executing Painless script: '${script}'`); | ||
|
||
const stackTraceElem = findTestSubject(component, 'painlessStackTrace').getDOMNode(); | ||
const stackTrace = failedShards!.reason.script_stack!.join('\n'); | ||
expect(stackTraceElem.textContent).toBe(stackTrace); | ||
|
||
expect(component.find('EuiButton').length).toBe(1); | ||
}); | ||
}); |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
Is this change necessary?
Looks like we creating
SearchTimeoutError
where we known we are passingKibanaServerError
Could it be
KibanaServerError
then?