Skip to content

Commit

Permalink
Fix typo in ESQLSearchResponse type (#184861)
Browse files Browse the repository at this point in the history
Fixes a small typo in the `ESQLSearchResponse` (formerly known as
`ESQLSearchReponse`).

Co-authored-by: Stratoula Kalafateli <[email protected]>
  • Loading branch information
dgieselaar and stratoula authored Jun 5, 2024
1 parent bff17fe commit 9560481
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-es-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export type {
MaybeReadonlyArray,
ESQLColumn,
ESQLRow,
ESQLSearchReponse,
ESQLSearchResponse,
ESQLSearchParams,
SearchField,
} from './src';
4 changes: 2 additions & 2 deletions packages/kbn-es-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SearchHit,
ESQLColumn,
ESQLRow,
ESQLSearchReponse,
ESQLSearchResponse,
ESQLSearchParams,
ChangePointType,
} from './search';
Expand Down Expand Up @@ -53,7 +53,7 @@ export type {
SearchHit,
ESQLColumn,
ESQLRow,
ESQLSearchReponse,
ESQLSearchResponse,
ESQLSearchParams,
ChangePointType,
};
2 changes: 1 addition & 1 deletion packages/kbn-es-types/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ export interface ESQLColumn {

export type ESQLRow = unknown[];

export interface ESQLSearchReponse {
export interface ESQLSearchResponse {
columns: ESQLColumn[];
// In case of ?drop_null_columns in the query, then
// all_columns will have available and empty fields
Expand Down
8 changes: 4 additions & 4 deletions packages/kbn-esql-utils/src/utils/run_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n';
import type { DatatableColumn } from '@kbn/expressions-plugin/common';
import type { ISearchGeneric } from '@kbn/search-types';
import { esFieldTypeToKibanaFieldType } from '@kbn/field-types';
import type { ESQLColumn, ESQLSearchReponse, ESQLSearchParams } from '@kbn/es-types';
import type { ESQLColumn, ESQLSearchResponse, ESQLSearchParams } from '@kbn/es-types';
import { lastValueFrom } from 'rxjs';

export function formatESQLColumns(columns: ESQLColumn[]): DatatableColumn[] {
Expand Down Expand Up @@ -49,7 +49,7 @@ export async function getESQLQueryColumnsRaw({
)
);

return (response.rawResponse as unknown as ESQLSearchReponse).columns ?? [];
return (response.rawResponse as unknown as ESQLSearchResponse).columns ?? [];
} catch (error) {
throw new Error(
i18n.translate('esqlUtils.columnsErrorMsg', {
Expand Down Expand Up @@ -100,7 +100,7 @@ export async function getESQLResults({
filter?: unknown;
dropNullColumns?: boolean;
}): Promise<{
response: ESQLSearchReponse;
response: ESQLSearchResponse;
params: ESQLSearchParams;
}> {
const result = await lastValueFrom(
Expand All @@ -119,7 +119,7 @@ export async function getESQLResults({
)
);
return {
response: result.rawResponse as unknown as ESQLSearchReponse,
response: result.rawResponse as unknown as ESQLSearchResponse,
params: result.requestParams as unknown as ESQLSearchParams,
};
}
2 changes: 1 addition & 1 deletion packages/kbn-generate-csv/src/generate_csv_esql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { IScopedSearchClient } from '@kbn/data-plugin/server';
import { dataPluginMock } from '@kbn/data-plugin/server/mocks';
import { CancellationToken } from '@kbn/reporting-common';
import type { ReportingConfigType } from '@kbn/reporting-server';
import type { ESQLSearchReponse as ESQLSearchResponse } from '@kbn/es-types';
import type { ESQLSearchResponse } from '@kbn/es-types';
import {
UI_SETTINGS_CSV_QUOTE_VALUES,
UI_SETTINGS_CSV_SEPARATOR,
Expand Down
4 changes: 2 additions & 2 deletions packages/kbn-generate-csv/src/generate_csv_esql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-ty
import { ESQL_SEARCH_STRATEGY, cellHasFormulas, getEsQueryConfig } from '@kbn/data-plugin/common';
import type { IScopedSearchClient } from '@kbn/data-plugin/server';
import { type Filter, buildEsQuery } from '@kbn/es-query';
import type { ESQLSearchParams, ESQLSearchReponse } from '@kbn/es-types';
import type { ESQLSearchParams, ESQLSearchResponse } from '@kbn/es-types';
import { i18n } from '@kbn/i18n';
import {
AuthenticationExpiredError,
Expand Down Expand Up @@ -103,7 +103,7 @@ export class CsvESQLGenerator {
const { rawResponse, warning } = await lastValueFrom(
this.clients.data.search<
IKibanaSearchRequest<ESQLSearchParams>,
IKibanaSearchResponse<ESQLSearchReponse>
IKibanaSearchResponse<ESQLSearchResponse>
>(searchParams, {
strategy: ESQL_SEARCH_STRATEGY,
abortSignal: abortController.signal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Side Public License, v 1.
*/

import type { ESQLSearchReponse } from '@kbn/es-types';
import type { ESQLSearchResponse } from '@kbn/es-types';
import { appendToESQLQuery } from '@kbn/esql-utils';
import type { DataViewField } from '@kbn/data-views-plugin/common';
import type { FieldStatsResponse } from '../../types';
Expand All @@ -22,7 +22,7 @@ import {
} from '../../utils/can_provide_stats';
import { getFieldExampleBuckets } from '../field_examples_calculator';

export type SearchHandlerTextBased = ({ query }: { query: string }) => Promise<ESQLSearchReponse>;
export type SearchHandlerTextBased = ({ query }: { query: string }) => Promise<ESQLSearchResponse>;

export function buildSearchFilter({
timeFieldName,
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/common/search/expressions/esql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Observable, defer, throwError } from 'rxjs';
import { catchError, map, switchMap, tap } from 'rxjs';
import { buildEsQuery } from '@kbn/es-query';
import type { ISearchGeneric } from '@kbn/search-types';
import type { ESQLSearchReponse, ESQLSearchParams } from '@kbn/es-types';
import type { ESQLSearchResponse, ESQLSearchParams } from '@kbn/es-types';
import { getEsQueryConfig } from '../../es_query';
import { getTime } from '../../query';
import { ESQL_ASYNC_SEARCH_STRATEGY, KibanaContext, ESQL_TABLE_TYPE } from '..';
Expand Down Expand Up @@ -194,7 +194,7 @@ export const getEsqlFn = ({ getStartDependencies }: EsqlFnArguments) => {

return search<
IKibanaSearchRequest<ESQLSearchParams>,
IKibanaSearchResponse<ESQLSearchReponse>
IKibanaSearchResponse<ESQLSearchResponse>
>(
{ params: { ...params, dropNullColumns: true } },
{ abortSignal, strategy: ESQL_ASYNC_SEARCH_STRATEGY }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ESQL_ASYNC_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
import pLimit from 'p-limit';
import { chunk } from 'lodash';
import { isDefined } from '@kbn/ml-is-defined';
import type { ESQLSearchReponse } from '@kbn/es-types';
import type { ESQLSearchResponse } from '@kbn/es-types';
import { appendToESQLQuery } from '@kbn/esql-utils';
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
Expand Down Expand Up @@ -111,7 +111,7 @@ const getESQLOverallStatsInChunk = async ({
if (!esqlResults) {
return;
}
const esqlResultsResp = esqlResults.rawResponse as unknown as ESQLSearchReponse;
const esqlResultsResp = esqlResults.rawResponse as unknown as ESQLSearchResponse;

const sampleCount = !isDefined(limitSize) ? totalCount : limitSize;
fieldsToFetch.forEach((field, idx) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
// @ts-ignore
import { parse } from 'wellknown';
import { Feature, FeatureCollection, GeoJsonProperties } from 'geojson';
import type { ESQLSearchReponse } from '@kbn/es-types';
import type { ESQLSearchResponse } from '@kbn/es-types';
import { EMPTY_FEATURE_COLLECTION } from '../../../../common/constants';
import { isGeometryColumn } from './esql_utils';

export function convertToGeoJson(resp: ESQLSearchReponse): FeatureCollection {
export function convertToGeoJson(resp: ESQLSearchResponse): FeatureCollection {
const geometryColumnIndex = resp.columns.findIndex(isGeometryColumn);
if (geometryColumnIndex === -1) {
return EMPTY_FEATURE_COLLECTION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Adapters } from '@kbn/inspector-plugin/common/adapters';
import { getIndexPatternFromESQLQuery, getLimitFromESQLQuery } from '@kbn/esql-utils';
import { buildEsQuery } from '@kbn/es-query';
import type { Filter, Query } from '@kbn/es-query';
import type { ESQLSearchParams, ESQLSearchReponse } from '@kbn/es-types';
import type { ESQLSearchParams, ESQLSearchResponse } from '@kbn/es-types';
import { getEsQueryConfig } from '@kbn/data-service/src/es_query';
import { getTime } from '@kbn/data-plugin/public';
import { FIELD_ORIGIN, SOURCE_TYPES, VECTOR_SHAPE_TYPE } from '../../../../common/constants';
Expand Down Expand Up @@ -238,7 +238,7 @@ export class ESQLSource

requestResponder.ok({ json: rawResponse, requestParams });

const esqlSearchResponse = rawResponse as unknown as ESQLSearchReponse;
const esqlSearchResponse = rawResponse as unknown as ESQLSearchResponse;
const resultsCount = esqlSearchResponse.values.length;
return {
data: convertToGeoJson(esqlSearchResponse),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { validateQuery } from '@kbn/esql-validation-autocomplete';
import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
import type { ElasticsearchClient } from '@kbn/core/server';
import { ESQLSearchReponse, ESQLRow } from '@kbn/es-types';
import { ESQLSearchResponse, ESQLRow } from '@kbn/es-types';
import { esFieldTypeToKibanaFieldType, type KBN_FIELD_TYPES } from '@kbn/field-types';
import { splitIntoCommands } from './correct_common_esql_mistakes';

Expand Down Expand Up @@ -57,7 +57,7 @@ export async function runAndValidateEsqlQuery({
},
})
.then((res) => {
const esqlResponse = res as ESQLSearchReponse;
const esqlResponse = res as ESQLSearchResponse;

const columns =
esqlResponse.columns?.map(({ name, type }) => ({
Expand Down

0 comments on commit 9560481

Please sign in to comment.