mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[8.7] [Discover] Fix Elasticsearch query rule for "KQL or Lucene" query without filters (#151632) (#151705)
# Backport This will backport the following commits from `main` to `8.7`: - [[Discover] Fix Elasticsearch query rule for "KQL or Lucene" query without filters (#151632)](https://github.com/elastic/kibana/pull/151632) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"julia.rechkunova@elastic.co"},"sourceCommit":{"committedDate":"2023-02-21T13:46:42Z","message":"[Discover] Fix Elasticsearch query rule for \"KQL or Lucene\" query without filters (#151632)\n\nCloses https://github.com/elastic/kibana/issues/151609 \r\n\r\nFor testing:\r\n- Go to Rule Management page\r\n- Create a new Rule with \"Elasticsearch query\" type in \"KQL or Lucene\"\r\nformat\r\n- Save and check the status after the rule finishes the creating process\r\n=> It should say \"Succeeded\"","sha":"17ab3a31dd8528d92d3c4a928b7e0923a48b037a","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:DataDiscovery","backport:prev-minor","v8.8.0"],"number":151632,"url":"https://github.com/elastic/kibana/pull/151632","mergeCommit":{"message":"[Discover] Fix Elasticsearch query rule for \"KQL or Lucene\" query without filters (#151632)\n\nCloses https://github.com/elastic/kibana/issues/151609 \r\n\r\nFor testing:\r\n- Go to Rule Management page\r\n- Create a new Rule with \"Elasticsearch query\" type in \"KQL or Lucene\"\r\nformat\r\n- Save and check the status after the rule finishes the creating process\r\n=> It should say \"Succeeded\"","sha":"17ab3a31dd8528d92d3c4a928b7e0923a48b037a"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151632","number":151632,"mergeCommit":{"message":"[Discover] Fix Elasticsearch query rule for \"KQL or Lucene\" query without filters (#151632)\n\nCloses https://github.com/elastic/kibana/issues/151609 \r\n\r\nFor testing:\r\n- Go to Rule Management page\r\n- Create a new Rule with \"Elasticsearch query\" type in \"KQL or Lucene\"\r\nformat\r\n- Save and check the status after the rule finishes the creating process\r\n=> It should say \"Succeeded\"","sha":"17ab3a31dd8528d92d3c4a928b7e0923a48b037a"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
This commit is contained in:
parent
47ad464819
commit
ba57a80840
2 changed files with 58 additions and 1 deletions
|
@ -188,7 +188,7 @@ async function generateLink(
|
|||
}
|
||||
|
||||
function updateFilterReferences(filters: Filter[], fromDataView: string, toDataView: string) {
|
||||
return filters.map((filter) => {
|
||||
return (filters || []).map((filter) => {
|
||||
if (filter.meta.index === fromDataView) {
|
||||
return {
|
||||
...filter,
|
||||
|
|
|
@ -32,6 +32,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
const filterBar = getService('filterBar');
|
||||
const find = getService('find');
|
||||
const toasts = getService('toasts');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
const SOURCE_DATA_VIEW = 'search-source-alert';
|
||||
const OUTPUT_DATA_VIEW = 'search-source-alert-output';
|
||||
|
@ -330,6 +331,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await deleteDataView(outputDataViewId);
|
||||
await deleteConnector(connectorId);
|
||||
await security.testUser.restoreDefaults();
|
||||
await kibanaServer.savedObjects.cleanStandardList();
|
||||
});
|
||||
|
||||
it('should create an alert when there is no data view', async () => {
|
||||
|
@ -535,5 +537,60 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
await checkInitialRuleParamsState(SOURCE_DATA_VIEW);
|
||||
await checkInitialDataViewState(SOURCE_DATA_VIEW);
|
||||
});
|
||||
|
||||
it('should check that there are no errors detected after an alert is created', async () => {
|
||||
const newAlert = 'New Alert for checking its status';
|
||||
await createDataView('search-source*');
|
||||
|
||||
await PageObjects.common.navigateToApp('management');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await testSubjects.click('triggersActions');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await testSubjects.click('createRuleButton');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await retry.waitFor('rule name value is correct', async () => {
|
||||
await testSubjects.setValue('ruleNameInput', newAlert);
|
||||
const ruleName = await testSubjects.getAttribute('ruleNameInput', 'value');
|
||||
return ruleName === newAlert;
|
||||
});
|
||||
|
||||
await testSubjects.click('.es-query-SelectOption');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
await testSubjects.click('queryFormType_searchSource');
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await testSubjects.click('selectDataViewExpression');
|
||||
await testSubjects.click('indexPattern-switcher--input');
|
||||
if (await testSubjects.exists('clearSearchButton')) {
|
||||
await testSubjects.click('clearSearchButton');
|
||||
}
|
||||
const dataViewsElem = await testSubjects.find('euiSelectableList');
|
||||
const sourceDataViewOption = await dataViewsElem.findByCssSelector(
|
||||
`[title="search-source*"]`
|
||||
);
|
||||
await sourceDataViewOption.click();
|
||||
|
||||
await testSubjects.click('saveRuleButton');
|
||||
|
||||
await retry.waitFor('confirmation modal', async () => {
|
||||
return await testSubjects.exists('confirmModalConfirmButton');
|
||||
});
|
||||
|
||||
await testSubjects.click('confirmModalConfirmButton');
|
||||
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
await openAlertRuleInManagement(newAlert);
|
||||
|
||||
await retry.waitFor('success status', async () => {
|
||||
await browser.refresh();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
|
||||
return await testSubjects.exists('ruleStatus-ok');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue