forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[errors/multi.allow_explicit_index] move error handling to browser (e…
…lastic#14184) * [errors/multi.allow_explicit_index] move error handling to browser A part of elastic#14163, this removes the portion of the healthCheck that tries to verify that rest.action.multi.allow_explicit_index is not set to false. Instead, a ui module was created that will check errors from elasticsearch for this specific scenario, and exposes a method that will display a nicer "fatal error" screen that informs the user about what they should do, and navigates away from the now broken app. * [es/healthCheck] remove old test * fix typo
- Loading branch information
1 parent
25abdd1
commit 83f31ec
Showing
8 changed files
with
67 additions
and
117 deletions.
There are no files selected for viewing
75 changes: 0 additions & 75 deletions
75
src/core_plugins/elasticsearch/lib/__tests__/ensure_allow_explicit_index.js
This file was deleted.
Oops, something went wrong.
36 changes: 0 additions & 36 deletions
36
src/core_plugins/elasticsearch/lib/ensure_allow_explicit_index.js
This file was deleted.
Oops, something went wrong.
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
19 changes: 19 additions & 0 deletions
19
src/ui/public/error_allow_explicit_index/error_allow_explicit_index.html
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,19 @@ | ||
<div class="app-container error-multi-allow-explicit-index"> | ||
<h3> | ||
<i aria-hidden="true" class="fa fa-warning text-danger"></i> Oh no! | ||
</h3> | ||
<p> | ||
It looks like your Elasticsearch cluster has the <code>rest.action.multi.allow_explicit_index</code> setting set to <code>false</code>, which prevents Kibana from making search requests. We use this ability to send a single request to Elasticsearch that searches multiple indexes so that when there are many panels on a dashboard they will load quickly and uniformly. | ||
</p> | ||
|
||
<p> | ||
Unfortunately, until this issue is fixed you won't be able to use certain apps in Kibana, like Discover, Visualize and Dashboard. | ||
</p> | ||
|
||
<h3>Ok, how do I fix this?</h3> | ||
<ol> | ||
<li>Remove <code>rest.action.multi.allow_explicit_index: false</code> from your Elasticsearch config file.</li> | ||
<li>Restart Elasticsearch.</li> | ||
<li>Use the browser's back button to return to what you were doing.</li> | ||
</ol> | ||
</div> |
35 changes: 35 additions & 0 deletions
35
src/ui/public/error_allow_explicit_index/error_allow_explicit_index.js
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,35 @@ | ||
import { get } from 'lodash'; | ||
|
||
import uiRoutes from 'ui/routes'; | ||
import { KbnUrlProvider } from 'ui/url'; | ||
|
||
import './error_allow_explicit_index.less'; | ||
import template from './error_allow_explicit_index.html'; | ||
|
||
uiRoutes | ||
.when('/error/multi.allow_explicit_index', { template }); | ||
|
||
export function ErrorAllowExplicitIndexProvider(Private, Promise) { | ||
const kbnUrl = Private(KbnUrlProvider); | ||
|
||
return new class ErrorAllowExplicitIndex { | ||
test(error) { | ||
if (!error || error.status !== 400) { | ||
return false; | ||
} | ||
|
||
const type = get(error, 'body.error.type'); | ||
const reason = get(error, 'body.error.reason'); | ||
|
||
return ( | ||
type === 'illegal_argument_exception' && | ||
String(reason).includes('explicit index') | ||
); | ||
} | ||
|
||
takeover() { | ||
kbnUrl.change('/error/multi.allow_explicit_index'); | ||
return Promise.halt(); | ||
} | ||
}; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/ui/public/error_allow_explicit_index/error_allow_explicit_index.less
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,3 @@ | ||
.error-multi-allow-explicit-index { | ||
padding: 25px; | ||
} |
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 @@ | ||
export { ErrorAllowExplicitIndexProvider } from './error_allow_explicit_index'; |