Skip to content

Commit

Permalink
Merge branch 'main' into remove_browser_field_type
Browse files Browse the repository at this point in the history
  • Loading branch information
lgestc authored Aug 1, 2024
2 parents 9131eb0 + 7e46462 commit d520293
Show file tree
Hide file tree
Showing 34 changed files with 574 additions and 140 deletions.
Binary file added docs/user/images/array-in-metrics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/create-simple-api-key.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/dashboard-creator-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/dashboard-creator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/dashboard-last-editor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/esql-field-statistics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/field-statistics-esql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/integrations-in-esql.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/share-modal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/statistics-in-legends.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/user/images/statistics-in-legends2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
192 changes: 117 additions & 75 deletions docs/user/whats-new.asciidoc

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ const { pollEsNodesVersion: pollEsNodesVersionActual } = jest.requireActual(

const isValidConnectionMock = isValidConnection as jest.Mock;

const delay = async (durationMs: number) =>
await new Promise((resolve) => setTimeout(resolve, durationMs));
const TICK = 10;
const tick = (ticks = 1) => jest.advanceTimersByTime(TICK * ticks);

const configService = configServiceMock.create();

Expand All @@ -67,11 +67,13 @@ beforeEach(() => {

env = Env.createDefault(REPO_ROOT, getEnvOptions());

jest.useFakeTimers();

mockConfig$ = new BehaviorSubject({
hosts: ['http://1.2.3.4'],
healthCheck: {
delay: duration(10),
startupDelay: duration(10),
delay: duration(TICK),
startupDelay: duration(TICK),
},
ssl: {
verificationMode: 'none',
Expand All @@ -96,6 +98,7 @@ beforeEach(() => {

afterEach(async () => {
jest.clearAllMocks();
jest.useRealTimers();
MockClusterClient.mockClear();
isScriptingEnabledMock.mockReset();
getClusterInfoMock.mockReset();
Expand Down Expand Up @@ -223,13 +226,18 @@ describe('#setup', () => {
elasticsearchClientMock.createErrorTransportRequestPromise(new Error())
);

expect(mockedClient.nodes.info).toHaveBeenCalledTimes(0);

const setupContract = await elasticsearchService.setup(setupDeps);
await delay(10);

expect(mockedClient.nodes.info).toHaveBeenCalledTimes(0);
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(1);

tick();

expect(mockedClient.nodes.info).toHaveBeenCalledTimes(2);

await firstValueFrom(setupContract.esNodesCompatibility$);
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(1);
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(2); // shares the last value
});

it('esNodeVersionCompatibility$ stops polling when unsubscribed from', async () => {
Expand All @@ -238,13 +246,17 @@ describe('#setup', () => {
elasticsearchClientMock.createErrorTransportRequestPromise(new Error())
);

expect(mockedClient.nodes.info).toHaveBeenCalledTimes(0);

const setupContract = await elasticsearchService.setup(setupDeps);

expect(mockedClient.nodes.info).toHaveBeenCalledTimes(0);
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(1);

await firstValueFrom(setupContract.esNodesCompatibility$);
await delay(100);
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(1);

tick();

expect(mockedClient.nodes.info).toHaveBeenCalledTimes(2);
});
});

Expand Down Expand Up @@ -276,6 +288,7 @@ describe('#start', () => {
pollEsNodesVersionMocked.mockImplementation(() => observable$);

await elasticsearchService.setup(setupDeps);
tick();
await elasticsearchService.start();
expect(loggingSystemMock.collect(coreContext.logger).error).toEqual([]);
observable$.next({
Expand All @@ -290,7 +303,7 @@ describe('#start', () => {

it('logs an info message about connecting to ES', async () => {
isValidConnectionMock.mockImplementation(async () => {
await new Promise((r) => setTimeout(r, 50));
tick();
});

await elasticsearchService.setup(setupDeps);
Expand All @@ -309,7 +322,7 @@ describe('#start', () => {

it('returns the information about the time spent waiting for Elasticsearch', async () => {
isValidConnectionMock.mockImplementation(async () => {
await new Promise((r) => setTimeout(r, 50));
tick();
});

await elasticsearchService.setup(setupDeps);
Expand Down Expand Up @@ -487,11 +500,11 @@ describe('#stop', () => {
setupContract.esNodesCompatibility$.pipe(
concatMap(async () => {
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(1);
await delay(10);
tick();
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(2);

await elasticsearchService.stop();
await delay(100);
tick(10);
expect(mockedClient.nodes.info).toHaveBeenCalledTimes(2);
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
* Side Public License, v 1.
*/

import { firstValueFrom, Observable, Subject } from 'rxjs';
import { map, takeUntil } from 'rxjs';
import { map, takeUntil, firstValueFrom, Observable, Subject } from 'rxjs';

import type { Logger } from '@kbn/logging';
import type { CoreContext, CoreService } from '@kbn/core-base-server-internal';
Expand Down Expand Up @@ -107,6 +106,13 @@ export class ElasticsearchService
internalClient: this.client.asInternalUser,
}).pipe(takeUntil(this.stop$));

// Log every error we may encounter in the connection to Elasticsearch
esNodesCompatibility$.subscribe(({ isCompatible, message }) => {
if (!isCompatible && message) {
this.log.error(message);
}
});

this.esNodesCompatibility$ = esNodesCompatibility$;

this.clusterInfo$ = getClusterInfo$(this.client.asInternalUser);
Expand Down Expand Up @@ -138,13 +144,6 @@ export class ElasticsearchService

const config = await firstValueFrom(this.config$);

// Log every error we may encounter in the connection to Elasticsearch
this.esNodesCompatibility$.subscribe(({ isCompatible, message }) => {
if (!isCompatible && message) {
this.log.error(message);
}
});

let capabilities: ElasticsearchCapabilities;
let elasticsearchWaitTime: number;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
* that defined in Kibana's package.json.
*/

import { interval, of, from, Observable, BehaviorSubject } from 'rxjs';
import {
interval,
of,
from,
Observable,
BehaviorSubject,
map,
distinctUntilChanged,
catchError,
Expand Down
61 changes: 50 additions & 11 deletions packages/kbn-search-connectors/types/native_connectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4662,6 +4662,45 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
},
sharepoint_server: {
configuration: {
authentication: {
default_value: null,
depends_on: [],
display: DisplayType.DROPDOWN,
label: i18n.translate(
'searchConnectors.nativeConnectors.sharepoint_server.configuration.authentication',
{
defaultMessage: 'Authentication',
}
),
options: [
{
label: i18n.translate(
'searchConnectors.nativeConnectors.sharepoint_server.options.basicLabel',
{
defaultMessage: 'Basic',
}
),
value: 'basic_auth',
},
{
label: i18n.translate(
'searchConnectors.nativeConnectors.sharepoint_server.options.ntlmLabel',
{
defaultMessage: 'NTLM',
}
),
value: 'ntlm_auth',
},
],
order: 1,
required: true,
sensitive: false,
tooltip: null,
type: FieldType.STRING,
ui_restrictions: [],
validations: [],
value: 'basic_auth',
},
username: {
default_value: null,
depends_on: [],
Expand All @@ -4673,7 +4712,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
}
),
options: [],
order: 1,
order: 2,
required: true,
sensitive: false,
tooltip: '',
Expand All @@ -4693,7 +4732,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
}
),
options: [],
order: 2,
order: 3,
required: true,
sensitive: true,
tooltip: '',
Expand All @@ -4713,7 +4752,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
}
),
options: [],
order: 3,
order: 4,
required: true,
sensitive: false,
tooltip: '',
Expand All @@ -4733,7 +4772,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
}
),
options: [],
order: 4,
order: 5,
required: true,
sensitive: false,
tooltip: '',
Expand All @@ -4748,7 +4787,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
display: DisplayType.TOGGLE,
label: ENABLE_SSL_LABEL,
options: [],
order: 5,
order: 6,
required: true,
sensitive: false,
tooltip: null,
Expand All @@ -4768,7 +4807,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
display: DisplayType.TEXTBOX,
label: SSL_CERTIFICATE_LABEL,
options: [],
order: 6,
order: 7,
required: true,
sensitive: false,
tooltip: null,
Expand All @@ -4783,7 +4822,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
display: DisplayType.NUMERIC,
label: RETRIES_PER_REQUEST_LABEL,
options: [],
order: 7,
order: 8,
required: false,
sensitive: false,
tooltip: null,
Expand All @@ -4798,7 +4837,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
display: DisplayType.TOGGLE,
label: USE_TEXT_EXTRACTION_SERVICE_LABEL,
options: [],
order: 8,
order: 9,
required: true,
sensitive: false,
tooltip: USE_TEXT_EXTRACTION_SERVICE_TOOLTIP,
Expand All @@ -4813,7 +4852,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
display: DisplayType.TOGGLE,
label: ENABLE_DOCUMENT_LEVEL_SECURITY_LABEL,
options: [],
order: 9,
order: 10,
required: true,
sensitive: false,
tooltip: getEnableDocumentLevelSecurityTooltip(
Expand Down Expand Up @@ -4842,7 +4881,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
}
),
options: [],
order: 10,
order: 11,
required: true,
sensitive: false,
tooltip: i18n.translate(
Expand Down Expand Up @@ -4873,7 +4912,7 @@ export const NATIVE_CONNECTOR_DEFINITIONS: Record<string, NativeConnector | unde
}
),
options: [],
order: 11,
order: 12,
required: true,
sensitive: false,
tooltip: i18n.translate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ export class DataViewEditorService {
const getFieldsOptions: GetFieldsOptions = {
pattern: this.indexPattern,
allowHidden: this.allowHidden,
allowNoIndex: true,
};
if (this.type === INDEX_PATTERN_TYPE.ROLLUP) {
getFieldsOptions.type = INDEX_PATTERN_TYPE.ROLLUP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ export class IndexPatternsFetcher {
fieldTypes,
includeEmptyFields,
} = options;
const allowNoIndices = fieldCapsOptions
? fieldCapsOptions.allow_no_indices
: this.allowNoIndices;
const allowNoIndices = fieldCapsOptions?.allow_no_indices || this.allowNoIndices;

const expandWildcards = allowHidden ? 'all' : 'open';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,18 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
return Promise.all(comparedHeaders);
});
});

it('should support unmatched index pattern segments', async function () {
await PageObjects.settings.createIndexPattern('l*,z*', '@timestamp');
const patternName = await PageObjects.settings.getIndexPageHeading();
expect(patternName).to.be('l*,z*');
await PageObjects.settings.removeIndexPattern();
});
});

describe('edit index pattern', () => {
it('on edit click', async () => {
await testSubjects.click('detail-link-logstash-*');
await PageObjects.settings.editIndexPattern('logstash-*', '@timestamp', 'Logstash Star');

await retry.try(async () => {
Expand Down
18 changes: 16 additions & 2 deletions x-pack/plugins/search_playground/public/utils/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ type StreamPartValueType = {
export type StreamPartType =
| ReturnType<typeof textStreamPart.parse>
| ReturnType<typeof errorStreamPart.parse>
| ReturnType<typeof messageAnnotationsStreamPart.parse>;
| ReturnType<typeof messageAnnotationsStreamPart.parse>
| ReturnType<typeof bufferStreamPart.parse>;

const NEWLINE = '\n'.charCodeAt(0);

Expand Down Expand Up @@ -121,7 +122,20 @@ const messageAnnotationsStreamPart = createStreamPart('8', 'message_annotations'
return { type: 'message_annotations', value };
});

const streamParts = [textStreamPart, errorStreamPart, messageAnnotationsStreamPart] as const;
const bufferStreamPart = createStreamPart('10', 'buffer', (value) => {
if (typeof value !== 'string') {
throw new Error('"buffer" parts expect a string value.');
}

return { type: 'buffer', value };
});

const streamParts = [
textStreamPart,
errorStreamPart,
bufferStreamPart,
messageAnnotationsStreamPart,
] as const;

type StreamPartMap = {
[P in StreamParts as P['code']]: P;
Expand Down
Loading

0 comments on commit d520293

Please sign in to comment.