Skip to content

Commit 80c142a

Browse files
authored
[Search] Fix unrecognized parameter: [indexType] error (elastic#212707)
## Summary This PR fixes an issue introduced in elastic#208776 where switching from ES|QL mode to classic mode in Discover caused the search request to fail with an `unrecognized parameter: [indexType]` error. This was because the `indexType` was actually being sent as part of the search request `params` when it shouldn't have been. We already had some rollup tests that would have caught it, but a workaround was also added to the rollup search strategy to sidestep the issue, preventing the tests from failing. That workaround has been removed and existing ES|QL tests updated to catch the issue specifically for ES|QL mode. Fixes elastic#212704. ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
1 parent 3ce9019 commit 80c142a

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/platform/plugins/shared/data/common/search/search_source/search_source.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,12 @@ export class SearchSource {
544544
options: SearchSourceSearchOptions
545545
): Observable<IKibanaSearchResponse<unknown>> {
546546
const { search, getConfig, onResponse } = this.dependencies;
547-
548-
const params = getSearchParamsFromRequest(searchRequest, {
547+
const { indexType, ...restRequest } = searchRequest;
548+
const params = getSearchParamsFromRequest(restRequest, {
549549
getConfig,
550550
});
551551

552-
return search({ params, indexType: searchRequest.indexType }, options).pipe(
552+
return search({ params, indexType }, options).pipe(
553553
switchMap((response) => {
554554
// For testing timeout messages in UI, uncomment the next line
555555
// response.rawResponse.timed_out = true;

src/platform/plugins/shared/data/server/search/strategies/ese_search/ese_search_strategy.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { catchError, tap } from 'rxjs';
1313
import { firstValueFrom, from } from 'rxjs';
1414
import type { ISearchOptions, IEsSearchRequest, IEsSearchResponse } from '@kbn/search-types';
1515
import { getKbnServerError } from '@kbn/kibana-utils-plugin/server';
16-
import { omit } from 'lodash';
1716
import { IAsyncSearchRequestParams } from '../..';
1817
import { getKbnSearchError, KbnSearchError } from '../../report_search_error';
1918
import type { ISearchStrategy, SearchStrategyDependencies } from '../../types';
@@ -171,7 +170,7 @@ export const enhancedEsSearchStrategyProvider = (
171170
const esResponse = await client.rollup.rollupSearch(
172171
{
173172
...querystring,
174-
...omit(request.params, ['indexType']),
173+
...request.params,
175174
index: request.params.index,
176175
},
177176
{

test/functional/apps/discover/esql/_esql_view.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
318318
});
319319
});
320320

321-
it('should show available data views after switching to classic mode', async () => {
321+
it('should show available data views and search results after switching to classic mode', async () => {
322322
await discover.selectTextBaseLang();
323323
await header.waitUntilLoadingHasFinished();
324324
await discover.waitUntilSearchingHasFinished();
@@ -329,6 +329,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
329329
await unifiedSearch.switchToDataViewMode();
330330
await header.waitUntilLoadingHasFinished();
331331
await discover.waitUntilSearchingHasFinished();
332+
await discover.assertHitCount('14,004');
332333
const availableDataViews = await unifiedSearch.getDataViewList(
333334
'discover-dataView-switch-link'
334335
);

x-pack/test_serverless/functional/test_suites/common/discover/esql/_esql_view.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
318318
});
319319
});
320320

321-
it('should show available data views after switching to classic mode', async () => {
321+
it('should show available data views and search results after switching to classic mode', async () => {
322322
await PageObjects.discover.selectTextBaseLang();
323323
await PageObjects.header.waitUntilLoadingHasFinished();
324324
await PageObjects.discover.waitUntilSearchingHasFinished();
@@ -329,6 +329,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
329329
await PageObjects.unifiedSearch.switchToDataViewMode();
330330
await PageObjects.header.waitUntilLoadingHasFinished();
331331
await PageObjects.discover.waitUntilSearchingHasFinished();
332+
await PageObjects.discover.assertHitCount('14,004');
332333
const availableDataViews = await PageObjects.unifiedSearch.getDataViewList(
333334
'discover-dataView-switch-link'
334335
);

0 commit comments

Comments
 (0)