mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
This reverts commit 5c78c01321
.
## Summary
Reverts the https://github.com/elastic/kibana/pull/184053 as we don't
want to land in serverless before ES PR does.
This commit is contained in:
parent
7de4fef3c1
commit
72eea169d7
27 changed files with 72 additions and 12 deletions
|
@ -688,6 +688,7 @@ export interface ESQLSearchParams {
|
||||||
// https://github.com/elastic/elasticsearch/pull/102767
|
// https://github.com/elastic/elasticsearch/pull/102767
|
||||||
// time_zone?: string;
|
// time_zone?: string;
|
||||||
query: string;
|
query: string;
|
||||||
|
version: string;
|
||||||
filter?: unknown;
|
filter?: unknown;
|
||||||
locale?: string;
|
locale?: string;
|
||||||
dropNullColumns?: boolean;
|
dropNullColumns?: boolean;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||||
* Side Public License, v 1.
|
* Side Public License, v 1.
|
||||||
*/
|
*/
|
||||||
// only used for security solution
|
|
||||||
|
// we are expecting to retrieve this from an API instead
|
||||||
|
// https://github.com/elastic/elasticsearch/issues/107069
|
||||||
export const ESQL_LATEST_VERSION = '2024.04.01';
|
export const ESQL_LATEST_VERSION = '2024.04.01';
|
||||||
export const ENABLE_ESQL = 'enableESQL';
|
export const ENABLE_ESQL = 'enableESQL';
|
||||||
|
|
|
@ -22,4 +22,4 @@ export {
|
||||||
TextBasedLanguages,
|
TextBasedLanguages,
|
||||||
} from './src';
|
} from './src';
|
||||||
|
|
||||||
export { ENABLE_ESQL, ESQL_LATEST_VERSION } from './constants';
|
export { ESQL_LATEST_VERSION, ENABLE_ESQL } from './constants';
|
||||||
|
|
|
@ -11,6 +11,7 @@ import type { ISearchGeneric } from '@kbn/search-types';
|
||||||
import { esFieldTypeToKibanaFieldType } from '@kbn/field-types';
|
import { esFieldTypeToKibanaFieldType } from '@kbn/field-types';
|
||||||
import type { ESQLColumn, ESQLSearchReponse, ESQLSearchParams } from '@kbn/es-types';
|
import type { ESQLColumn, ESQLSearchReponse, ESQLSearchParams } from '@kbn/es-types';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
|
import { ESQL_LATEST_VERSION } from '../../constants';
|
||||||
|
|
||||||
export function formatESQLColumns(columns: ESQLColumn[]): DatatableColumn[] {
|
export function formatESQLColumns(columns: ESQLColumn[]): DatatableColumn[] {
|
||||||
return columns.map(({ name, type }) => {
|
return columns.map(({ name, type }) => {
|
||||||
|
@ -40,6 +41,7 @@ export async function getESQLQueryColumnsRaw({
|
||||||
{
|
{
|
||||||
params: {
|
params: {
|
||||||
query: `${esqlQuery} | limit 0`,
|
query: `${esqlQuery} | limit 0`,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -74,6 +76,7 @@ export async function getESQLQueryColumns({
|
||||||
try {
|
try {
|
||||||
const rawColumns = await getESQLQueryColumnsRaw({ esqlQuery, search, signal });
|
const rawColumns = await getESQLQueryColumnsRaw({ esqlQuery, search, signal });
|
||||||
const columns = formatESQLColumns(rawColumns) ?? [];
|
const columns = formatESQLColumns(rawColumns) ?? [];
|
||||||
|
|
||||||
return columns;
|
return columns;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
@ -109,6 +112,7 @@ export async function getESQLResults({
|
||||||
params: {
|
params: {
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
query: esqlQuery,
|
query: esqlQuery,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
...(dropNullColumns ? { dropNullColumns: true } : {}),
|
...(dropNullColumns ? { dropNullColumns: true } : {}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -22,6 +22,7 @@ import type { IKibanaSearchResponse } from '@kbn/search-types';
|
||||||
import { IScopedSearchClient } from '@kbn/data-plugin/server';
|
import { IScopedSearchClient } from '@kbn/data-plugin/server';
|
||||||
import { dataPluginMock } from '@kbn/data-plugin/server/mocks';
|
import { dataPluginMock } from '@kbn/data-plugin/server/mocks';
|
||||||
import { CancellationToken } from '@kbn/reporting-common';
|
import { CancellationToken } from '@kbn/reporting-common';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import type { ReportingConfigType } from '@kbn/reporting-server';
|
import type { ReportingConfigType } from '@kbn/reporting-server';
|
||||||
import type { ESQLSearchReponse as ESQLSearchResponse } from '@kbn/es-types';
|
import type { ESQLSearchReponse as ESQLSearchResponse } from '@kbn/es-types';
|
||||||
import {
|
import {
|
||||||
|
@ -311,7 +312,7 @@ describe('CsvESQLGenerator', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(mockDataClientSearchFn).toBeCalledWith(
|
expect(mockDataClientSearchFn).toBeCalledWith(
|
||||||
{ params: { filter: undefined, locale: 'en', query: '' } },
|
{ params: { filter: undefined, locale: 'en', query: '', version: ESQL_LATEST_VERSION } },
|
||||||
{
|
{
|
||||||
strategy: 'esql',
|
strategy: 'esql',
|
||||||
transport: {
|
transport: {
|
||||||
|
@ -389,7 +390,7 @@ describe('CsvESQLGenerator', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(mockDataClientSearchFn).toBeCalledWith(
|
expect(mockDataClientSearchFn).toBeCalledWith(
|
||||||
{ params: { filter: undefined, locale: 'en', query: '' } },
|
{ params: { filter: undefined, locale: 'en', query: '', version: ESQL_LATEST_VERSION } },
|
||||||
{
|
{
|
||||||
strategy: 'esql',
|
strategy: 'esql',
|
||||||
transport: {
|
transport: {
|
||||||
|
@ -485,6 +486,7 @@ describe('CsvESQLGenerator', () => {
|
||||||
},
|
},
|
||||||
locale: 'en',
|
locale: 'en',
|
||||||
query: '',
|
query: '',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import type { Writable } from 'stream';
|
import type { Writable } from 'stream';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { errors as esErrors } from '@elastic/elasticsearch';
|
import { errors as esErrors } from '@elastic/elasticsearch';
|
||||||
import type { IScopedClusterClient, IUiSettingsClient, Logger } from '@kbn/core/server';
|
import type { IScopedClusterClient, IUiSettingsClient, Logger } from '@kbn/core/server';
|
||||||
import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-types';
|
import type { IKibanaSearchResponse, IKibanaSearchRequest } from '@kbn/search-types';
|
||||||
|
@ -94,6 +95,7 @@ export class CsvESQLGenerator {
|
||||||
// we will need to add it back in once it is supported again.
|
// we will need to add it back in once it is supported again.
|
||||||
// https://github.com/elastic/elasticsearch/pull/102767
|
// https://github.com/elastic/elasticsearch/pull/102767
|
||||||
// timezone
|
// timezone
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
"@kbn/reporting-export-types-csv-common",
|
"@kbn/reporting-export-types-csv-common",
|
||||||
"@kbn/es-query",
|
"@kbn/es-query",
|
||||||
"@kbn/es-types",
|
"@kbn/es-types",
|
||||||
|
"@kbn/esql-utils",
|
||||||
"@kbn/data-views-plugin",
|
"@kbn/data-views-plugin",
|
||||||
"@kbn/search-types",
|
"@kbn/search-types",
|
||||||
]
|
]
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { catchError, map, switchMap, tap } from 'rxjs';
|
||||||
import { buildEsQuery } from '@kbn/es-query';
|
import { buildEsQuery } from '@kbn/es-query';
|
||||||
import type { ISearchGeneric } from '@kbn/search-types';
|
import type { ISearchGeneric } from '@kbn/search-types';
|
||||||
import type { ESQLSearchReponse, ESQLSearchParams } from '@kbn/es-types';
|
import type { ESQLSearchReponse, ESQLSearchParams } from '@kbn/es-types';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { getEsQueryConfig } from '../../es_query';
|
import { getEsQueryConfig } from '../../es_query';
|
||||||
import { getTime } from '../../query';
|
import { getTime } from '../../query';
|
||||||
import { ESQL_ASYNC_SEARCH_STRATEGY, KibanaContext } from '..';
|
import { ESQL_ASYNC_SEARCH_STRATEGY, KibanaContext } from '..';
|
||||||
|
@ -147,6 +148,7 @@ export const getEsqlFn = ({ getStartDependencies }: EsqlFnArguments) => {
|
||||||
query,
|
query,
|
||||||
// time_zone: timezone,
|
// time_zone: timezone,
|
||||||
locale,
|
locale,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
if (input) {
|
if (input) {
|
||||||
const esQueryConfigs = getEsQueryConfig(
|
const esQueryConfigs = getEsQueryConfig(
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
import { firstValueFrom } from 'rxjs';
|
import { firstValueFrom } from 'rxjs';
|
||||||
import { KbnServerError } from '@kbn/kibana-utils-plugin/server';
|
import { KbnServerError } from '@kbn/kibana-utils-plugin/server';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { KbnSearchError } from '../../report_search_error';
|
import { KbnSearchError } from '../../report_search_error';
|
||||||
import { errors } from '@elastic/elasticsearch';
|
import { errors } from '@elastic/elasticsearch';
|
||||||
import indexNotFoundException from '../../../../common/search/test_data/index_not_found_exception.json';
|
import indexNotFoundException from '../../../../common/search/test_data/index_not_found_exception.json';
|
||||||
|
@ -66,6 +67,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
await esSearch
|
await esSearch
|
||||||
.search(
|
.search(
|
||||||
|
@ -89,6 +91,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
|
@ -108,6 +111,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
wait_for_completion_timeout: '10s',
|
wait_for_completion_timeout: '10s',
|
||||||
keep_alive: '5m',
|
keep_alive: '5m',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
|
@ -123,7 +127,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
it('sets transport options on POST requests', async () => {
|
it('sets transport options on POST requests', async () => {
|
||||||
const transportOptions = { maxRetries: 1 };
|
const transportOptions = { maxRetries: 1 };
|
||||||
mockApiCaller.mockResolvedValueOnce(mockAsyncResponse);
|
mockApiCaller.mockResolvedValueOnce(mockAsyncResponse);
|
||||||
const params = { query: 'from logs' };
|
const params = { query: 'from logs', version: ESQL_LATEST_VERSION };
|
||||||
const esSearch = esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
await firstValueFrom(
|
await firstValueFrom(
|
||||||
|
@ -140,6 +144,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
wait_for_completion_timeout: '100ms',
|
wait_for_completion_timeout: '100ms',
|
||||||
keep_on_completion: false,
|
keep_on_completion: false,
|
||||||
query: 'from logs',
|
query: 'from logs',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({ maxRetries: 1, meta: true, signal: undefined })
|
expect.objectContaining({ maxRetries: 1, meta: true, signal: undefined })
|
||||||
|
@ -150,6 +155,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
mockApiCaller.mockResolvedValueOnce(mockAsyncResponse);
|
mockApiCaller.mockResolvedValueOnce(mockAsyncResponse);
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
|
@ -175,6 +181,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
|
@ -197,6 +204,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
const abortController = new AbortController();
|
const abortController = new AbortController();
|
||||||
|
@ -230,6 +238,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
|
@ -253,6 +262,7 @@ describe('ES|QL async search strategy', () => {
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
query: 'from logs* | limit 10',
|
query: 'from logs* | limit 10',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
const esSearch = await esqlAsyncSearchStrategyProvider(mockSearchConfig, mockLogger);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
"@kbn/es-types",
|
"@kbn/es-types",
|
||||||
"@kbn/code-editor",
|
"@kbn/code-editor",
|
||||||
"@kbn/core-test-helpers-model-versions",
|
"@kbn/core-test-helpers-model-versions",
|
||||||
|
"@kbn/esql-utils",
|
||||||
"@kbn/react-kibana-mount",
|
"@kbn/react-kibana-mount",
|
||||||
"@kbn/search-types"
|
"@kbn/search-types"
|
||||||
],
|
],
|
||||||
|
|
|
@ -11,6 +11,7 @@ import Path from 'path';
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
import { MappingProperty } from '@elastic/elasticsearch/lib/api/types';
|
import { MappingProperty } from '@elastic/elasticsearch/lib/api/types';
|
||||||
import { REPO_ROOT } from '@kbn/repo-info';
|
import { REPO_ROOT } from '@kbn/repo-info';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import uniqBy from 'lodash/uniqBy';
|
import uniqBy from 'lodash/uniqBy';
|
||||||
import { groupBy, mapValues } from 'lodash';
|
import { groupBy, mapValues } from 'lodash';
|
||||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||||
|
@ -126,6 +127,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
path: '/_query',
|
path: '/_query',
|
||||||
body: {
|
body: {
|
||||||
query,
|
query,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
return { resp, error: undefined };
|
return { resp, error: undefined };
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
import request from 'superagent';
|
import request from 'superagent';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { inflateResponse } from '@kbn/bfetch-plugin/public/streaming';
|
import { inflateResponse } from '@kbn/bfetch-plugin/public/streaming';
|
||||||
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
|
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
|
||||||
import { BFETCH_ROUTE_VERSION_LATEST } from '@kbn/bfetch-plugin/common';
|
import { BFETCH_ROUTE_VERSION_LATEST } from '@kbn/bfetch-plugin/common';
|
||||||
|
@ -413,6 +414,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
request: {
|
request: {
|
||||||
params: {
|
params: {
|
||||||
query: 'from .kibana | limit 1',
|
query: 'from .kibana | limit 1',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
@ -441,6 +443,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
request: {
|
request: {
|
||||||
params: {
|
params: {
|
||||||
query: 'fro .kibana | limit 1',
|
query: 'fro .kibana | limit 1',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|
|
@ -72,6 +72,7 @@
|
||||||
"@kbn/links-plugin",
|
"@kbn/links-plugin",
|
||||||
"@kbn/ftr-common-functional-ui-services",
|
"@kbn/ftr-common-functional-ui-services",
|
||||||
"@kbn/monaco",
|
"@kbn/monaco",
|
||||||
|
"@kbn/esql-utils",
|
||||||
"@kbn/search-types",
|
"@kbn/search-types",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { type UseCancellableSearch, useCancellableSearch } from '@kbn/ml-cancell
|
||||||
import type { estypes } from '@elastic/elasticsearch';
|
import type { estypes } from '@elastic/elasticsearch';
|
||||||
import type { ISearchOptions } from '@kbn/search-types';
|
import type { ISearchOptions } from '@kbn/search-types';
|
||||||
import type { TimeBucketsInterval } from '@kbn/ml-time-buckets';
|
import type { TimeBucketsInterval } from '@kbn/ml-time-buckets';
|
||||||
import { getESQLWithSafeLimit, appendToESQLQuery } from '@kbn/esql-utils';
|
import { getESQLWithSafeLimit, ESQL_LATEST_VERSION, appendToESQLQuery } from '@kbn/esql-utils';
|
||||||
import { isDefined } from '@kbn/ml-is-defined';
|
import { isDefined } from '@kbn/ml-is-defined';
|
||||||
import { OMIT_FIELDS } from '../../../../../common/constants';
|
import { OMIT_FIELDS } from '../../../../../common/constants';
|
||||||
import type {
|
import type {
|
||||||
|
@ -94,6 +94,7 @@ const getESQLDocumentCountStats = async (
|
||||||
params: {
|
params: {
|
||||||
query: aggQuery,
|
query: aggQuery,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
@ -139,6 +140,7 @@ const getESQLDocumentCountStats = async (
|
||||||
params: {
|
params: {
|
||||||
query: appendToESQLQuery(esqlBaseQuery, ' | STATS _count_ = COUNT(*) | LIMIT 1'),
|
query: appendToESQLQuery(esqlBaseQuery, ' | STATS _count_ = COUNT(*) | LIMIT 1'),
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
@ -268,6 +270,7 @@ export const useESQLOverallStatsData = (
|
||||||
// Doing this to match with the default limit
|
// Doing this to match with the default limit
|
||||||
query: esqlBaseQuery,
|
query: esqlBaseQuery,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
dropNullColumns: true,
|
dropNullColumns: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
||||||
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
||||||
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import { appendToESQLQuery } from '@kbn/esql-utils';
|
import { ESQL_LATEST_VERSION, appendToESQLQuery } from '@kbn/esql-utils';
|
||||||
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
||||||
import { getSafeESQLName } from '../requests/esql_utils';
|
import { getSafeESQLName } from '../requests/esql_utils';
|
||||||
import { isFulfilled, isRejected } from '../../../common/util/promise_all_settled_utils';
|
import { isFulfilled, isRejected } from '../../../common/util/promise_all_settled_utils';
|
||||||
|
@ -49,6 +49,7 @@ export const getESQLBooleanFieldStats = async ({
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ import pLimit from 'p-limit';
|
||||||
import { chunk } from 'lodash';
|
import { chunk } from 'lodash';
|
||||||
import { isDefined } from '@kbn/ml-is-defined';
|
import { isDefined } from '@kbn/ml-is-defined';
|
||||||
import type { ESQLSearchReponse } from '@kbn/es-types';
|
import type { ESQLSearchReponse } from '@kbn/es-types';
|
||||||
import { appendToESQLQuery } from '@kbn/esql-utils';
|
import { ESQL_LATEST_VERSION, appendToESQLQuery } from '@kbn/esql-utils';
|
||||||
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
||||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||||
import { i18n } from '@kbn/i18n';
|
import { i18n } from '@kbn/i18n';
|
||||||
|
@ -109,6 +109,7 @@ const getESQLOverallStatsInChunk = async ({
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
||||||
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
||||||
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
||||||
import { appendToESQLQuery } from '@kbn/esql-utils';
|
import { ESQL_LATEST_VERSION, appendToESQLQuery } from '@kbn/esql-utils';
|
||||||
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
||||||
import { getSafeESQLName } from '../requests/esql_utils';
|
import { getSafeESQLName } from '../requests/esql_utils';
|
||||||
import type { DateFieldStats, FieldStatsError } from '../../../../../common/types/field_stats';
|
import type { DateFieldStats, FieldStatsError } from '../../../../../common/types/field_stats';
|
||||||
|
@ -42,6 +42,7 @@ export const getESQLDateFieldStats = async ({
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
||||||
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
||||||
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import { appendToESQLQuery } from '@kbn/esql-utils';
|
import { ESQL_LATEST_VERSION, appendToESQLQuery } from '@kbn/esql-utils';
|
||||||
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
||||||
import { getSafeESQLName } from '../requests/esql_utils';
|
import { getSafeESQLName } from '../requests/esql_utils';
|
||||||
import { isFulfilled, isRejected } from '../../../common/util/promise_all_settled_utils';
|
import { isFulfilled, isRejected } from '../../../common/util/promise_all_settled_utils';
|
||||||
|
@ -47,6 +47,7 @@ export const getESQLKeywordFieldStats = async ({
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
import type { UseCancellableSearch } from '@kbn/ml-cancellable-search';
|
||||||
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
import type { QueryDslQueryContainer } from '@kbn/data-views-plugin/common/types';
|
||||||
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
import { ESQL_SEARCH_STRATEGY } from '@kbn/data-plugin/common';
|
||||||
import { appendToESQLQuery } from '@kbn/esql-utils';
|
import { ESQL_LATEST_VERSION, appendToESQLQuery } from '@kbn/esql-utils';
|
||||||
import { chunk } from 'lodash';
|
import { chunk } from 'lodash';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
import type { Column } from '../../hooks/esql/use_esql_overall_stats_data';
|
||||||
|
@ -71,6 +71,7 @@ const getESQLNumericFieldStatsInChunk = async ({
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
...(filter ? { filter } : {}),
|
...(filter ? { filter } : {}),
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -11,7 +11,11 @@ import { lastValueFrom } from 'rxjs';
|
||||||
import { tap } from 'rxjs';
|
import { tap } from 'rxjs';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
import { Adapters } from '@kbn/inspector-plugin/common/adapters';
|
import { Adapters } from '@kbn/inspector-plugin/common/adapters';
|
||||||
import { getIndexPatternFromESQLQuery, getLimitFromESQLQuery } from '@kbn/esql-utils';
|
import {
|
||||||
|
getIndexPatternFromESQLQuery,
|
||||||
|
getLimitFromESQLQuery,
|
||||||
|
ESQL_LATEST_VERSION,
|
||||||
|
} from '@kbn/esql-utils';
|
||||||
import { buildEsQuery } from '@kbn/es-query';
|
import { buildEsQuery } from '@kbn/es-query';
|
||||||
import type { Filter, Query } from '@kbn/es-query';
|
import type { Filter, Query } from '@kbn/es-query';
|
||||||
import type { ESQLSearchParams, ESQLSearchReponse } from '@kbn/es-types';
|
import type { ESQLSearchParams, ESQLSearchReponse } from '@kbn/es-types';
|
||||||
|
@ -153,6 +157,7 @@ export class ESQLSource
|
||||||
const params: ESQLSearchParams = {
|
const params: ESQLSearchParams = {
|
||||||
query: this._descriptor.esql,
|
query: this._descriptor.esql,
|
||||||
dropNullColumns: true,
|
dropNullColumns: true,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
};
|
};
|
||||||
|
|
||||||
const query: Query[] = [];
|
const query: Query[] = [];
|
||||||
|
|
|
@ -11,6 +11,7 @@ FROM library
|
||||||
| SORT year
|
| SORT year
|
||||||
| LIMIT 5
|
| LIMIT 5
|
||||||
""",
|
""",
|
||||||
|
"version": "2024.04.01"
|
||||||
```
|
```
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,6 +49,9 @@ For syntax, refer to Returning localized results.
|
||||||
Passing parameters to a query.
|
Passing parameters to a query.
|
||||||
`query`
|
`query`
|
||||||
(Required, string) ES|QL query to run. For syntax, refer to Syntax reference.
|
(Required, string) ES|QL query to run. For syntax, refer to Syntax reference.
|
||||||
|
`version`
|
||||||
|
(Required, string) ES|QL language version. Can be sent in short or long form, e.g.
|
||||||
|
`2024.04.01` or `2024.04.01.🚀`. See Language versions for details.
|
||||||
Response bodyedit
|
Response bodyedit
|
||||||
`columns`
|
`columns`
|
||||||
(array of objects)
|
(array of objects)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import pLimit from 'p-limit';
|
||||||
import Path from 'path';
|
import Path from 'path';
|
||||||
import { lastValueFrom, startWith } from 'rxjs';
|
import { lastValueFrom, startWith } from 'rxjs';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { FunctionVisibility, MessageRole } from '@kbn/observability-ai-assistant-plugin/common';
|
import { FunctionVisibility, MessageRole } from '@kbn/observability-ai-assistant-plugin/common';
|
||||||
import {
|
import {
|
||||||
VisualizeESQLUserIntention,
|
VisualizeESQLUserIntention,
|
||||||
|
@ -126,6 +127,7 @@ export function registerQueryFunction({ functions, resources }: FunctionRegistra
|
||||||
path: '_query',
|
path: '_query',
|
||||||
body: {
|
body: {
|
||||||
query,
|
query,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
})) as ESQLSearchReponse;
|
})) as ESQLSearchReponse;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
import { validateQuery } from '@kbn/esql-validation-autocomplete';
|
import { validateQuery } from '@kbn/esql-validation-autocomplete';
|
||||||
import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
|
import { getAstAndSyntaxErrors } from '@kbn/esql-ast';
|
||||||
import type { ElasticsearchClient } from '@kbn/core/server';
|
import type { ElasticsearchClient } from '@kbn/core/server';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { ESQLSearchReponse } from '@kbn/es-types';
|
import { ESQLSearchReponse } from '@kbn/es-types';
|
||||||
import { esFieldTypeToKibanaFieldType, type KBN_FIELD_TYPES } from '@kbn/field-types';
|
import { esFieldTypeToKibanaFieldType, type KBN_FIELD_TYPES } from '@kbn/field-types';
|
||||||
import { splitIntoCommands } from './correct_common_esql_mistakes';
|
import { splitIntoCommands } from './correct_common_esql_mistakes';
|
||||||
|
@ -56,6 +57,7 @@ export async function validateEsqlQuery({
|
||||||
path: '_query',
|
path: '_query',
|
||||||
body: {
|
body: {
|
||||||
query: performantQuery,
|
query: performantQuery,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
|
@ -67,6 +67,7 @@ describe('fetchEsqlQuery', () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"query": "from test",
|
"query": "from test",
|
||||||
|
"version": "2024.04.01",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
@ -94,6 +95,7 @@ describe('fetchEsqlQuery', () => {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"query": "from test | limit 100",
|
"query": "from test | limit 100",
|
||||||
|
"version": "2024.04.01",
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { parseAggregationResults } from '@kbn/triggers-actions-ui-plugin/common';
|
import { parseAggregationResults } from '@kbn/triggers-actions-ui-plugin/common';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { SharePluginStart } from '@kbn/share-plugin/server';
|
import { SharePluginStart } from '@kbn/share-plugin/server';
|
||||||
import { IScopedClusterClient, Logger } from '@kbn/core/server';
|
import { IScopedClusterClient, Logger } from '@kbn/core/server';
|
||||||
import { OnlyEsqlQueryRuleParams } from '../types';
|
import { OnlyEsqlQueryRuleParams } from '../types';
|
||||||
|
@ -90,6 +91,7 @@ export const getEsqlQuery = (
|
||||||
|
|
||||||
const query = {
|
const query = {
|
||||||
query: alertLimit ? `${params.esqlQuery.esql} | limit ${alertLimit}` : params.esqlQuery.esql,
|
query: alertLimit ? `${params.esqlQuery.esql} | limit ${alertLimit}` : params.esqlQuery.esql,
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
filter: {
|
filter: {
|
||||||
bool: {
|
bool: {
|
||||||
filter: rangeFilter,
|
filter: rangeFilter,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
import request from 'superagent';
|
import request from 'superagent';
|
||||||
import { inflateResponse } from '@kbn/bfetch-plugin/public/streaming';
|
import { inflateResponse } from '@kbn/bfetch-plugin/public/streaming';
|
||||||
import expect from '@kbn/expect';
|
import expect from '@kbn/expect';
|
||||||
|
import { ESQL_LATEST_VERSION } from '@kbn/esql-utils';
|
||||||
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
|
import { ELASTIC_HTTP_VERSION_HEADER } from '@kbn/core-http-common';
|
||||||
import { BFETCH_ROUTE_VERSION_LATEST } from '@kbn/bfetch-plugin/common';
|
import { BFETCH_ROUTE_VERSION_LATEST } from '@kbn/bfetch-plugin/common';
|
||||||
import type { FtrProviderContext } from '../../ftr_provider_context';
|
import type { FtrProviderContext } from '../../ftr_provider_context';
|
||||||
|
@ -37,6 +38,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
request: {
|
request: {
|
||||||
params: {
|
params: {
|
||||||
query: 'from logstash-* | keep geo.coordinates | limit 0',
|
query: 'from logstash-* | keep geo.coordinates | limit 0',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
@ -72,6 +74,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
dropNullColumns: true,
|
dropNullColumns: true,
|
||||||
query:
|
query:
|
||||||
'from logstash-* | keep geo.coordinates, @timestamp | sort @timestamp | limit 1',
|
'from logstash-* | keep geo.coordinates, @timestamp | sort @timestamp | limit 1',
|
||||||
|
version: ESQL_LATEST_VERSION,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
|
|
|
@ -172,6 +172,7 @@
|
||||||
"@kbn/aiops-log-rate-analysis",
|
"@kbn/aiops-log-rate-analysis",
|
||||||
"@kbn/apm-data-view",
|
"@kbn/apm-data-view",
|
||||||
"@kbn/core-saved-objects-api-server",
|
"@kbn/core-saved-objects-api-server",
|
||||||
|
"@kbn/esql-utils",
|
||||||
"@kbn/search-types",
|
"@kbn/search-types",
|
||||||
"@kbn/analytics-ftr-helpers-plugin",
|
"@kbn/analytics-ftr-helpers-plugin",
|
||||||
"@kbn/reporting-server",
|
"@kbn/reporting-server",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue