[8.6] [RAM] allow no indices on alert search bar (#145437) (#145732)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[RAM] allow no indices on alert search bar
(#145437)](https://github.com/elastic/kibana/pull/145437)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Xavier
Mouligneau","email":"xavier.mouligneau@elastic.co"},"sourceCommit":{"committedDate":"2022-11-18T13:53:18Z","message":"[RAM]
allow no indices on alert search bar (#145437)\n\n##
Summary\r\n\r\nResolve:
https://github.com/elastic/kibana/issues/145246\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"beeea7d91e7bc39b80996f0713633800ecb1f708","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","impact:high","Team:ResponseOps","v8.6.0","v8.7.0"],"number":145437,"url":"https://github.com/elastic/kibana/pull/145437","mergeCommit":{"message":"[RAM]
allow no indices on alert search bar (#145437)\n\n##
Summary\r\n\r\nResolve:
https://github.com/elastic/kibana/issues/145246\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"beeea7d91e7bc39b80996f0713633800ecb1f708"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145437","number":145437,"mergeCommit":{"message":"[RAM]
allow no indices on alert search bar (#145437)\n\n##
Summary\r\n\r\nResolve:
https://github.com/elastic/kibana/issues/145246\r\n\r\nCo-authored-by:
Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"beeea7d91e7bc39b80996f0713633800ecb1f708"}}]}]
BACKPORT-->

Co-authored-by: Xavier Mouligneau <xavier.mouligneau@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-18 10:27:16 -05:00 committed by GitHub
parent 31f3c3ea62
commit a693baa3cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View file

@ -408,6 +408,7 @@ describe('ruleRegistrySearchStrategyProvider()', () => {
expect(searchStrategySearch).toHaveBeenCalledWith(
{
params: {
allow_no_indices: true,
body: {
_source: false,
fields: [
@ -425,6 +426,7 @@ describe('ruleRegistrySearchStrategyProvider()', () => {
size: 1000,
sort: [],
},
ignore_unavailable: true,
index: ['test-testSpace*'],
},
},
@ -461,6 +463,7 @@ describe('ruleRegistrySearchStrategyProvider()', () => {
expect(searchStrategySearch).toHaveBeenCalledWith(
{
params: {
allow_no_indices: true,
body: {
_source: false,
fields: [{ field: '@timestamp', include_unmapped: true }],
@ -473,6 +476,7 @@ describe('ruleRegistrySearchStrategyProvider()', () => {
size: 1000,
sort: [],
},
ignore_unavailable: true,
index: ['test-testSpace*'],
},
},

View file

@ -124,7 +124,9 @@ export const ruleRegistrySearchStrategyProvider = (
};
const size = request.pagination ? request.pagination.pageSize : MAX_ALERT_SEARCH_SIZE;
const params = {
allow_no_indices: true,
index: indices,
ignore_unavailable: true,
body: {
_source: false,
// TODO the fields need to come from the request

View file

@ -25,7 +25,7 @@ export function useAlertDataView(featureIds: ValidFeatureId[]): AsyncState<DataV
}
);
return dataService.dataViews.create({ title: indexNames.join(',') });
return dataService.dataViews.create({ title: indexNames.join(','), allowNoIndex: true });
}, [features]);
return dataView;