[Data] Unify autocomplete plugin (#95405)

Move KQL suggestions to data plugin
This commit is contained in:
Anton Dosov 2021-03-26 17:45:43 +01:00 committed by GitHub
parent ab33df898a
commit d305e2769a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 168 additions and 167 deletions

View file

@ -9,7 +9,7 @@ Fetch this source from Elasticsearch, returning an observable over the response(
<b>Signature:</b>
```typescript
fetch$(options?: ISearchOptions): import("rxjs").Observable<import("elasticsearch").SearchResponse<any>>;
fetch$(options?: ISearchOptions): import("rxjs").Observable<import("@elastic/elasticsearch/api/types").SearchResponse<any>>;
```
## Parameters
@ -20,5 +20,5 @@ fetch$(options?: ISearchOptions): import("rxjs").Observable<import("elasticsearc
<b>Returns:</b>
`import("rxjs").Observable<import("elasticsearch").SearchResponse<any>>`
`import("rxjs").Observable<import("@elastic/elasticsearch/api/types").SearchResponse<any>>`

View file

@ -21,7 +21,6 @@ It is wired into the `TopNavMenu` component, but can be used independently.
### Fetch Query Suggestions
The `getQuerySuggestions` function helps to construct a query.
KQL suggestion functions are registered in X-Pack, so this API does not return results in OSS.
```.ts

View file

@ -18,6 +18,11 @@ import {
import { ConfigSchema } from '../../config';
import { UsageCollectionSetup } from '../../../usage_collection/public';
import { createUsageCollector } from './collectors';
import {
KUERY_LANGUAGE_NAME,
setupKqlQuerySuggestionProvider,
} from './providers/kql_query_suggestion';
import { DataPublicPluginStart, DataStartDependencies } from '../types';
export class AutocompleteService {
autocompleteConfig: ConfigSchema['autocomplete'];
@ -31,12 +36,6 @@ export class AutocompleteService {
private readonly querySuggestionProviders: Map<string, QuerySuggestionGetFn> = new Map();
private getValueSuggestions?: ValueSuggestionsGetFn;
private addQuerySuggestionProvider = (language: string, provider: QuerySuggestionGetFn): void => {
if (language && provider && this.autocompleteConfig.querySuggestions.enabled) {
this.querySuggestionProviders.set(language, provider);
}
};
private getQuerySuggestions: QuerySuggestionGetFn = (args) => {
const { language } = args;
const provider = this.querySuggestionProviders.get(language);
@ -50,7 +49,7 @@ export class AutocompleteService {
/** @public **/
public setup(
core: CoreSetup,
core: CoreSetup<DataStartDependencies, DataPublicPluginStart>,
{
timefilter,
usageCollection,
@ -62,11 +61,15 @@ export class AutocompleteService {
? setupValueSuggestionProvider(core, { timefilter, usageCollector })
: getEmptyValueSuggestions;
return {
addQuerySuggestionProvider: this.addQuerySuggestionProvider,
if (this.autocompleteConfig.querySuggestions.enabled) {
this.querySuggestionProviders.set(KUERY_LANGUAGE_NAME, setupKqlQuerySuggestionProvider(core));
}
/** @obsolete **/
/** please use "getProvider" only from the start contract **/
return {
/**
* @deprecated
* please use "getQuerySuggestions" from the start contract
*/
getQuerySuggestions: this.getQuerySuggestions,
};
}

View file

@ -0,0 +1 @@
This is implementation of KQL query suggestions

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { setupGetConjunctionSuggestions } from './conjunction';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React from 'react';
@ -16,17 +17,17 @@ import {
const bothArgumentsText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText"
id="data.kueryAutocomplete.andOperatorDescription.bothArgumentsText"
defaultMessage="both arguments"
description="Part of xpack.data.kueryAutocomplete.andOperatorDescription. Full text: 'Requires both arguments to be true'"
description="Part of data.kueryAutocomplete.andOperatorDescription. Full text: 'Requires both arguments to be true'"
/>
);
const oneOrMoreArgumentsText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText"
id="data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText"
defaultMessage="one or more arguments"
description="Part of xpack.data.kueryAutocomplete.orOperatorDescription. Full text: 'Requires one or more arguments to be true'"
description="Part of data.kueryAutocomplete.orOperatorDescription. Full text: 'Requires one or more arguments to be true'"
/>
);
@ -34,20 +35,20 @@ const conjunctions: Record<string, JSX.Element> = {
and: (
<p>
<FormattedMessage
id="xpack.data.kueryAutocomplete.andOperatorDescription"
id="data.kueryAutocomplete.andOperatorDescription"
defaultMessage="Requires {bothArguments} to be true"
values={{
bothArguments: <span className="kbnSuggestionItem__callout">{bothArgumentsText}</span>,
}}
description="Full text: ' Requires both arguments to be true'. See
'xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText' for 'both arguments' part."
'data.kueryAutocomplete.andOperatorDescription.bothArgumentsText' for 'both arguments' part."
/>
</p>
),
or: (
<p>
<FormattedMessage
id="xpack.data.kueryAutocomplete.orOperatorDescription"
id="data.kueryAutocomplete.orOperatorDescription"
defaultMessage="Requires {oneOrMoreArguments} to be true"
values={{
oneOrMoreArguments: (
@ -55,7 +56,7 @@ const conjunctions: Record<string, JSX.Element> = {
),
}}
description="Full text: 'Requires one or more arguments to be true'. See
'xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText' for 'one or more arguments' part."
'data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText' for 'one or more arguments' part."
/>
</p>
),

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import indexPatternResponse from './__fixtures__/index_pattern_response.json';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React from 'react';
@ -22,7 +23,7 @@ const getDescription = (field: IFieldType) => {
return (
<p>
<FormattedMessage
id="xpack.data.kueryAutocomplete.filterResultsDescription"
id="data.kueryAutocomplete.filterResultsDescription"
defaultMessage="Filter results that contain {fieldName}"
values={{ fieldName: <span className="kbnSuggestionItem__callout">{field.name}</span> }}
/>

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { CoreSetup } from 'kibana/public';
@ -17,6 +18,7 @@ import {
QuerySuggestion,
QuerySuggestionGetFnArgs,
QuerySuggestionGetFn,
DataPublicPluginStart,
} from '../../../../../../../src/plugins/data/public';
const cursorSymbol = '@kuery-cursor@';
@ -26,7 +28,9 @@ const dedup = (suggestions: QuerySuggestion[]): QuerySuggestion[] =>
export const KUERY_LANGUAGE_NAME = 'kuery';
export const setupKqlQuerySuggestionProvider = (core: CoreSetup): QuerySuggestionGetFn => {
export const setupKqlQuerySuggestionProvider = (
core: CoreSetup<object, DataPublicPluginStart>
): QuerySuggestionGetFn => {
const providers = {
field: setupGetFieldSuggestions(core),
value: setupGetValueSuggestions(core),

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { escapeQuotes, escapeKuery } from './escape_kuery';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { flow } from 'lodash';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import indexPatternResponse from './__fixtures__/index_pattern_response.json';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import React from 'react';
@ -15,44 +16,44 @@ import { QuerySuggestionTypes } from '../../../../../../../src/plugins/data/publ
const equalsText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText"
id="data.kueryAutocomplete.equalOperatorDescription.equalsText"
defaultMessage="equals"
description="Part of xpack.data.kueryAutocomplete.equalOperatorDescription. Full text: 'equals some value'"
description="Part of data.kueryAutocomplete.equalOperatorDescription. Full text: 'equals some value'"
/>
);
const lessThanOrEqualToText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText"
id="data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText"
defaultMessage="less than or equal to"
description="Part of xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription. Full text: 'is less than or equal to some value'"
description="Part of data.kueryAutocomplete.lessThanOrEqualOperatorDescription. Full text: 'is less than or equal to some value'"
/>
);
const greaterThanOrEqualToText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText"
id="data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText"
defaultMessage="greater than or equal to"
description="Part of xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription. Full text: 'is greater than or equal to some value'"
description="Part of data.kueryAutocomplete.greaterThanOrEqualOperatorDescription. Full text: 'is greater than or equal to some value'"
/>
);
const lessThanText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText"
id="data.kueryAutocomplete.lessThanOperatorDescription.lessThanText"
defaultMessage="less than"
description="Part of xpack.data.kueryAutocomplete.lessThanOperatorDescription. Full text: 'is less than some value'"
description="Part of data.kueryAutocomplete.lessThanOperatorDescription. Full text: 'is less than some value'"
/>
);
const greaterThanText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText"
id="data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText"
defaultMessage="greater than"
description="Part of xpack.data.kueryAutocomplete.greaterThanOperatorDescription. Full text: 'is greater than some value'"
description="Part of data.kueryAutocomplete.greaterThanOperatorDescription. Full text: 'is greater than some value'"
/>
);
const existsText = (
<FormattedMessage
id="xpack.data.kueryAutocomplete.existOperatorDescription.existsText"
id="data.kueryAutocomplete.existOperatorDescription.existsText"
defaultMessage="exists"
description="Part of xpack.data.kueryAutocomplete.existOperatorDescription. Full text: 'exists in any form'"
description="Part of data.kueryAutocomplete.existOperatorDescription. Full text: 'exists in any form'"
/>
);
@ -60,11 +61,11 @@ const operators = {
':': {
description: (
<FormattedMessage
id="xpack.data.kueryAutocomplete.equalOperatorDescription"
id="data.kueryAutocomplete.equalOperatorDescription"
defaultMessage="{equals} some value"
values={{ equals: <span className="kbnSuggestionItem__callout">{equalsText}</span> }}
description="Full text: 'equals some value'. See
'xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText' for 'equals' part."
'data.kueryAutocomplete.equalOperatorDescription.equalsText' for 'equals' part."
/>
),
fieldTypes: [
@ -83,7 +84,7 @@ const operators = {
'<=': {
description: (
<FormattedMessage
id="xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription"
id="data.kueryAutocomplete.lessThanOrEqualOperatorDescription"
defaultMessage="is {lessThanOrEqualTo} some value"
values={{
lessThanOrEqualTo: (
@ -91,7 +92,7 @@ const operators = {
),
}}
description="Full text: 'is less than or equal to some value'. See
'xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText' for 'less than or equal to' part."
'data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText' for 'less than or equal to' part."
/>
),
fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'],
@ -99,7 +100,7 @@ const operators = {
'>=': {
description: (
<FormattedMessage
id="xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription"
id="data.kueryAutocomplete.greaterThanOrEqualOperatorDescription"
defaultMessage="is {greaterThanOrEqualTo} some value"
values={{
greaterThanOrEqualTo: (
@ -107,7 +108,7 @@ const operators = {
),
}}
description="Full text: 'is greater than or equal to some value'. See
'xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText' for 'greater than or equal to' part."
'data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText' for 'greater than or equal to' part."
/>
),
fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'],
@ -115,11 +116,11 @@ const operators = {
'<': {
description: (
<FormattedMessage
id="xpack.data.kueryAutocomplete.lessThanOperatorDescription"
id="data.kueryAutocomplete.lessThanOperatorDescription"
defaultMessage="is {lessThan} some value"
values={{ lessThan: <span className="kbnSuggestionItem__callout">{lessThanText}</span> }}
description="Full text: 'is less than some value'. See
'xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText' for 'less than' part."
'data.kueryAutocomplete.lessThanOperatorDescription.lessThanText' for 'less than' part."
/>
),
fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'],
@ -127,13 +128,13 @@ const operators = {
'>': {
description: (
<FormattedMessage
id="xpack.data.kueryAutocomplete.greaterThanOperatorDescription"
id="data.kueryAutocomplete.greaterThanOperatorDescription"
defaultMessage="is {greaterThan} some value"
values={{
greaterThan: <span className="kbnSuggestionItem__callout">{greaterThanText}</span>,
}}
description="Full text: 'is greater than some value'. See
'xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText' for 'greater than' part."
'data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText' for 'greater than' part."
/>
),
fieldTypes: ['number', 'number_range', 'date', 'date_range', 'ip', 'ip_range'],
@ -141,11 +142,11 @@ const operators = {
': *': {
description: (
<FormattedMessage
id="xpack.data.kueryAutocomplete.existOperatorDescription"
id="data.kueryAutocomplete.existOperatorDescription"
defaultMessage="{exists} in any form"
values={{ exists: <span className="kbnSuggestionItem__callout">{existsText}</span> }}
description="Full text: 'exists in any form'. See
'xpack.data.kueryAutocomplete.existOperatorDescription.existsText' for 'exists' part."
'data.kueryAutocomplete.existOperatorDescription.existsText' for 'exists' part."
/>
),
fieldTypes: undefined,

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { sortPrefixFirst } from './sort_prefix_first';

View file

@ -1,8 +1,9 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { partition } from 'lodash';

View file

@ -1,17 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { CoreSetup } from 'kibana/public';
import {
DataPublicPluginStart,
KueryNode,
QuerySuggestionBasic,
QuerySuggestionGetFnArgs,
} from '../../../../../../../src/plugins/data/public';
export type KqlQuerySuggestionProvider<T = QuerySuggestionBasic> = (
core: CoreSetup
core: CoreSetup<object, DataPublicPluginStart>
) => (querySuggestionsGetFnArgs: QuerySuggestionGetFnArgs, kueryNode: KueryNode) => Promise<T[]>;

View file

@ -1,15 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { setupGetValueSuggestions } from './value';
import indexPatternResponse from './__fixtures__/index_pattern_response.json';
import { coreMock } from '../../../../../../../src/core/public/mocks';
import { QuerySuggestionGetFnArgs, KueryNode } from '../../../../../../../src/plugins/data/public';
import { setAutocompleteService } from '../../../services';
const mockKueryNode = (kueryNode: Partial<KueryNode>) => (kueryNode as unknown) as KueryNode;
@ -19,11 +19,6 @@ describe('Kuery value suggestions', () => {
let autocompleteServiceMock: any;
beforeEach(() => {
getSuggestions = setupGetValueSuggestions(coreMock.createSetup());
querySuggestionsArgs = ({
indexPatterns: [indexPatternResponse],
} as unknown) as QuerySuggestionGetFnArgs;
autocompleteServiceMock = {
getValueSuggestions: jest.fn(({ field }) => {
let res: any[];
@ -40,7 +35,16 @@ describe('Kuery value suggestions', () => {
return Promise.resolve(res);
}),
};
setAutocompleteService(autocompleteServiceMock);
const coreSetup = coreMock.createSetup({
pluginStartContract: {
autocomplete: autocompleteServiceMock,
},
});
getSuggestions = setupGetValueSuggestions(coreSetup);
querySuggestionsArgs = ({
indexPatterns: [indexPatternResponse],
} as unknown) as QuerySuggestionGetFnArgs;
jest.clearAllMocks();
});

View file

@ -1,15 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { flatten } from 'lodash';
import { CoreSetup } from 'kibana/public';
import { escapeQuotes } from './lib/escape_kuery';
import { KqlQuerySuggestionProvider } from './types';
import { getAutocompleteService } from '../../../services';
import {
DataPublicPluginStart,
IFieldType,
IIndexPattern,
QuerySuggestion,
@ -26,7 +28,12 @@ const wrapAsSuggestions = (start: number, end: number, query: string, values: st
end,
}));
export const setupGetValueSuggestions: KqlQuerySuggestionProvider = () => {
export const setupGetValueSuggestions: KqlQuerySuggestionProvider = (
core: CoreSetup<object, DataPublicPluginStart>
) => {
const autoCompleteServicePromise = core
.getStartServices()
.then(([_, __, dataStart]) => dataStart.autocomplete);
return async (
{ indexPatterns, boolFilter, useTimeRange, signal },
{ start, end, prefix, suffix, fieldName, nestedPath }
@ -41,7 +48,7 @@ export const setupGetValueSuggestions: KqlQuerySuggestionProvider = () => {
});
const query = `${prefix}${suffix}`.trim();
const { getValueSuggestions } = getAutocompleteService();
const { getValueSuggestions } = await autoCompleteServicePromise;
const data = await Promise.all(
indexPatternFieldEntries.map(([indexPattern, field]) =>

View file

@ -17,7 +17,6 @@ export type Setup = jest.Mocked<ReturnType<Plugin['setup']>>;
export type Start = jest.Mocked<ReturnType<Plugin['start']>>;
const automcompleteSetupMock: jest.Mocked<AutocompleteSetup> = {
addQuerySuggestionProvider: jest.fn(),
getQuerySuggestions: jest.fn(),
};

View file

@ -23,7 +23,7 @@ import * as CSS from 'csstype';
import { Datatable as Datatable_2 } from 'src/plugins/expressions';
import { Datatable as Datatable_3 } from 'src/plugins/expressions/common';
import { DatatableColumn as DatatableColumn_2 } from 'src/plugins/expressions';
import { DatatableColumnType } from 'src/plugins/expressions/common';
import { DatatableColumnType as DatatableColumnType_2 } from 'src/plugins/expressions/common';
import { DetailedPeerCertificate } from 'tls';
import { Ensure } from '@kbn/utility-types';
import { EnvironmentMode } from '@kbn/config';
@ -85,8 +85,8 @@ import { RequestAdapter } from 'src/plugins/inspector/common';
import { RequestStatistics as RequestStatistics_2 } from 'src/plugins/inspector/common';
import { Required } from '@kbn/utility-types';
import * as Rx from 'rxjs';
import { SavedObject } from 'kibana/server';
import { SavedObject as SavedObject_2 } from 'src/core/server';
import { SavedObject } from 'src/core/server';
import { SavedObject as SavedObject_2 } from 'kibana/server';
import { SavedObjectReference } from 'src/core/types';
import { SavedObjectsClientContract } from 'src/core/public';
import { SavedObjectsFindOptions } from 'kibana/public';
@ -188,7 +188,7 @@ export class AggConfig {
// @deprecated (undocumented)
toJSON(): AggConfigSerialized;
// Warning: (ae-forgotten-export) The symbol "SerializableState" needs to be exported by the entry point index.d.ts
toSerializedFieldFormat(): {} | Ensure<SerializedFieldFormat_2<SerializableState>, SerializableState>;
toSerializedFieldFormat(): {} | Ensure<SerializedFieldFormat_2<SerializableState_2>, SerializableState_2>;
// (undocumented)
get type(): IAggType;
set type(type: IAggType);
@ -272,9 +272,9 @@ export type AggConfigSerialized = Ensure<{
type: string;
enabled?: boolean;
id?: string;
params?: {} | SerializableState;
params?: {} | SerializableState_2;
schema?: string;
}, SerializableState>;
}, SerializableState_2>;
// Warning: (ae-missing-release-tag) "AggFunctionsMapping" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@ -1604,7 +1604,7 @@ export class IndexPatternsService {
// Warning: (ae-forgotten-export) The symbol "IndexPatternSavedObjectAttrs" needs to be exported by the entry point index.d.ts
//
// (undocumented)
getCache: () => Promise<SavedObject_2<IndexPatternSavedObjectAttrs>[] | null | undefined>;
getCache: () => Promise<SavedObject<IndexPatternSavedObjectAttrs>[] | null | undefined>;
getDefault: () => Promise<IndexPattern | null>;
getFieldsForIndexPattern: (indexPattern: IndexPattern | IndexPatternSpec, options?: GetFieldsOptions | undefined) => Promise<any>;
// Warning: (ae-forgotten-export) The symbol "GetFieldsOptions" needs to be exported by the entry point index.d.ts
@ -1616,7 +1616,7 @@ export class IndexPatternsService {
}>>;
getTitles: (refresh?: boolean) => Promise<string[]>;
refreshFields: (indexPattern: IndexPattern) => Promise<void>;
savedObjectToSpec: (savedObject: SavedObject_2<IndexPatternAttributes>) => IndexPatternSpec;
savedObjectToSpec: (savedObject: SavedObject<IndexPatternAttributes>) => IndexPatternSpec;
setDefault: (id: string, force?: boolean) => Promise<void>;
updateSavedObject(indexPattern: IndexPattern, saveAttempts?: number, ignoreErrors?: boolean): Promise<void | Error>;
}

View file

@ -7,7 +7,14 @@
"declaration": true,
"declarationMap": true
},
"include": ["common/**/*", "public/**/*", "server/**/*", "config.ts", "common/**/*.json"],
"include": [
"common/**/*",
"public/**/*",
"server/**/*",
"config.ts",
"common/**/*.json",
"public/**/*.json"
],
"references": [
{ "path": "../../core/tsconfig.json" },
{ "path": "../bfetch/tsconfig.json" },
@ -16,6 +23,6 @@
{ "path": "../inspector/tsconfig.json" },
{ "path": "../usage_collection/tsconfig.json" },
{ "path": "../kibana_utils/tsconfig.json" },
{ "path": "../kibana_react/tsconfig.json" },
{ "path": "../kibana_react/tsconfig.json" }
]
}

View file

@ -1,11 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
export {
setupKqlQuerySuggestionProvider,
KUERY_LANGUAGE_NAME,
} from './providers/kql_query_suggestion';

View file

@ -17,8 +17,6 @@ import { BfetchPublicSetup } from '../../../../src/plugins/bfetch/public';
import { ManagementSetup } from '../../../../src/plugins/management/public';
import { SharePluginStart } from '../../../../src/plugins/share/public';
import { setAutocompleteService } from './services';
import { setupKqlQuerySuggestionProvider, KUERY_LANGUAGE_NAME } from './autocomplete';
import { EnhancedSearchInterceptor } from './search/search_interceptor';
import { registerSearchSessionsMgmt } from './search/sessions_mgmt';
import { toMountPoint } from '../../../../src/plugins/kibana_react/public';
@ -52,11 +50,6 @@ export class DataEnhancedPlugin
core: CoreSetup<DataEnhancedStartDependencies>,
{ bfetch, data, management }: DataEnhancedSetupDependencies
) {
data.autocomplete.addQuerySuggestionProvider(
KUERY_LANGUAGE_NAME,
setupKqlQuerySuggestionProvider(core)
);
this.enhancedSearchInterceptor = new EnhancedSearchInterceptor({
bfetch,
toasts: core.notifications.toasts,
@ -83,8 +76,6 @@ export class DataEnhancedPlugin
}
public start(core: CoreStart, plugins: DataEnhancedStartDependencies) {
setAutocompleteService(plugins.data.autocomplete);
if (this.config.search.sessions.enabled) {
core.chrome.setBreadcrumbsAppendExtension({
content: toMountPoint(

View file

@ -1,13 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { createGetterSetter } from '../../../../src/plugins/kibana_utils/public';
import { DataPublicPluginStart } from '../../../../src/plugins/data/public';
export const [getAutocompleteService, setAutocompleteService] = createGetterSetter<
DataPublicPluginStart['autocomplete']
>('Autocomplete');

View file

@ -13,8 +13,6 @@
"server/**/*",
"config.ts",
"../../../typings/**/*",
// have to declare *.json explicitly due to https://github.com/microsoft/TypeScript/issues/25636
"public/autocomplete/providers/kql_query_suggestion/__fixtures__/*.json",
"common/search/test_data/*.json"
],
"references": [

View file

@ -1443,6 +1443,23 @@
"data.searchSessionIndicator.noCapability": "検索セッションを作成するアクセス権がありません。",
"data.triggers.applyFilterDescription": "Kibanaフィルターが適用されるとき。単一の値または範囲フィルターにすることができます。",
"data.triggers.applyFilterTitle": "フィルターを適用",
"data.kueryAutocomplete.andOperatorDescription": "{bothArguments} が true であることを条件とする",
"data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "両方の引数",
"data.kueryAutocomplete.equalOperatorDescription": "一部の値に{equals}",
"data.kueryAutocomplete.equalOperatorDescription.equalsText": "一致する",
"data.kueryAutocomplete.existOperatorDescription": "いずれかの形式中に{exists}",
"data.kueryAutocomplete.existOperatorDescription.existsText": "存在する",
"data.kueryAutocomplete.filterResultsDescription": "{fieldName}を含む結果をフィルタリング",
"data.kueryAutocomplete.greaterThanOperatorDescription": "が一部の値{greaterThan}",
"data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "より大きい",
"data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "が一部の値{greaterThanOrEqualTo}",
"data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "よりも大きいまたは等しい",
"data.kueryAutocomplete.lessThanOperatorDescription": "が一部の値{lessThan}",
"data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "より小さい",
"data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "が一部の値{lessThanOrEqualTo}",
"data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "より小さいまたは等しい",
"data.kueryAutocomplete.orOperatorDescription": "{oneOrMoreArguments} が true であることを条件とする",
"data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数",
"devTools.badge.readOnly.text": "読み取り専用",
"devTools.badge.readOnly.tooltip": "を保存できませんでした",
"devTools.devToolsTitle": "開発ツール",
@ -7291,23 +7308,6 @@
"xpack.dashboardMode.uiSettings.dashboardsOnlyRolesTitle": "ダッシュボード専用ロール",
"xpack.data.advancedSettings.searchTimeout": "検索タイムアウト",
"xpack.data.advancedSettings.searchTimeoutDesc": "検索セッションの最大タイムアウトを変更するか、0に設定してタイムアウトを無効にすると、クエリは完了するまで実行されます。",
"xpack.data.kueryAutocomplete.andOperatorDescription": "{bothArguments} が true であることを条件とする",
"xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "両方の引数",
"xpack.data.kueryAutocomplete.equalOperatorDescription": "一部の値に{equals}",
"xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText": "一致する",
"xpack.data.kueryAutocomplete.existOperatorDescription": "いずれかの形式中に{exists}",
"xpack.data.kueryAutocomplete.existOperatorDescription.existsText": "存在する",
"xpack.data.kueryAutocomplete.filterResultsDescription": "{fieldName}を含む結果をフィルタリング",
"xpack.data.kueryAutocomplete.greaterThanOperatorDescription": "が一部の値{greaterThan}",
"xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "より大きい",
"xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "が一部の値{greaterThanOrEqualTo}",
"xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "よりも大きいまたは等しい",
"xpack.data.kueryAutocomplete.lessThanOperatorDescription": "が一部の値{lessThan}",
"xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "より小さい",
"xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "が一部の値{lessThanOrEqualTo}",
"xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "より小さいまたは等しい",
"xpack.data.kueryAutocomplete.orOperatorDescription": "{oneOrMoreArguments} が true であることを条件とする",
"xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数",
"xpack.data.mgmt.searchSessions.actionDelete": "削除",
"xpack.data.mgmt.searchSessions.actionExtend": "延長",
"xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "さらにアクションを表示",

View file

@ -1451,6 +1451,23 @@
"data.searchSessionIndicator.noCapability": "您无权创建搜索会话。",
"data.triggers.applyFilterDescription": "应用 kibana 筛选时。可能是单个值或范围筛选。",
"data.triggers.applyFilterTitle": "应用筛选",
"data.kueryAutocomplete.andOperatorDescription": "需要{bothArguments}为 true",
"data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "两个参数都",
"data.kueryAutocomplete.equalOperatorDescription": "{equals}某一值",
"data.kueryAutocomplete.equalOperatorDescription.equalsText": "等于",
"data.kueryAutocomplete.existOperatorDescription": "以任意形式{exists}",
"data.kueryAutocomplete.existOperatorDescription.existsText": "存在",
"data.kueryAutocomplete.filterResultsDescription": "筛选包含 {fieldName} 的结果",
"data.kueryAutocomplete.greaterThanOperatorDescription": "{greaterThan}某一值",
"data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "大于",
"data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "{greaterThanOrEqualTo}某一值",
"data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "大于或等于",
"data.kueryAutocomplete.lessThanOperatorDescription": "{lessThan}某一值",
"data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "小于",
"data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "{lessThanOrEqualTo}某一值",
"data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "小于或等于",
"data.kueryAutocomplete.orOperatorDescription": "需要{oneOrMoreArguments}为 true",
"data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数",
"devTools.badge.readOnly.text": "只读",
"devTools.badge.readOnly.tooltip": "无法保存",
"devTools.devToolsTitle": "开发工具",
@ -7352,23 +7369,6 @@
"xpack.dashboardMode.uiSettings.dashboardsOnlyRolesTitle": "仅限仪表板的角色",
"xpack.data.advancedSettings.searchTimeout": "搜索超时",
"xpack.data.advancedSettings.searchTimeoutDesc": "更改搜索会话的最大超时值,或设置为 0 以禁用超时,让查询运行至结束。",
"xpack.data.kueryAutocomplete.andOperatorDescription": "需要{bothArguments}为 true",
"xpack.data.kueryAutocomplete.andOperatorDescription.bothArgumentsText": "两个参数都",
"xpack.data.kueryAutocomplete.equalOperatorDescription": "{equals}某一值",
"xpack.data.kueryAutocomplete.equalOperatorDescription.equalsText": "等于",
"xpack.data.kueryAutocomplete.existOperatorDescription": "以任意形式{exists}",
"xpack.data.kueryAutocomplete.existOperatorDescription.existsText": "存在",
"xpack.data.kueryAutocomplete.filterResultsDescription": "筛选包含 {fieldName} 的结果",
"xpack.data.kueryAutocomplete.greaterThanOperatorDescription": "{greaterThan}某一值",
"xpack.data.kueryAutocomplete.greaterThanOperatorDescription.greaterThanText": "大于",
"xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription": "{greaterThanOrEqualTo}某一值",
"xpack.data.kueryAutocomplete.greaterThanOrEqualOperatorDescription.greaterThanOrEqualToText": "大于或等于",
"xpack.data.kueryAutocomplete.lessThanOperatorDescription": "{lessThan}某一值",
"xpack.data.kueryAutocomplete.lessThanOperatorDescription.lessThanText": "小于",
"xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription": "{lessThanOrEqualTo}某一值",
"xpack.data.kueryAutocomplete.lessThanOrEqualOperatorDescription.lessThanOrEqualToText": "小于或等于",
"xpack.data.kueryAutocomplete.orOperatorDescription": "需要{oneOrMoreArguments}为 true",
"xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数",
"xpack.data.mgmt.searchSessions.actionDelete": "删除",
"xpack.data.mgmt.searchSessions.actionExtend": "延长",
"xpack.data.mgmt.searchSessions.actions.tooltip.moreActions": "更多操作",