mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
[index patterns] Fleep app - Keep saved object field list until field caps provides fields (#85370)
This commit is contained in:
parent
9fce3b2c88
commit
c129f93083
37 changed files with 241 additions and 91 deletions
|
@ -0,0 +1,13 @@
|
||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPattern](./kibana-plugin-plugins-data-public.indexpattern.md) > [allowNoIndex](./kibana-plugin-plugins-data-public.indexpattern.allownoindex.md)
|
||||||
|
|
||||||
|
## IndexPattern.allowNoIndex property
|
||||||
|
|
||||||
|
prevents errors when index pattern exists before indices
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
readonly allowNoIndex: boolean;
|
||||||
|
```
|
|
@ -19,6 +19,7 @@ getAsSavedObjectBody(): {
|
||||||
fieldFormatMap: string | undefined;
|
fieldFormatMap: string | undefined;
|
||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
typeMeta: string | undefined;
|
typeMeta: string | undefined;
|
||||||
|
allowNoIndex: true | undefined;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
@ -33,5 +34,6 @@ getAsSavedObjectBody(): {
|
||||||
fieldFormatMap: string | undefined;
|
fieldFormatMap: string | undefined;
|
||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
typeMeta: string | undefined;
|
typeMeta: string | undefined;
|
||||||
|
allowNoIndex: true | undefined;
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ export declare class IndexPattern implements IIndexPattern
|
||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
| Property | Modifiers | Type | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
|
| [allowNoIndex](./kibana-plugin-plugins-data-public.indexpattern.allownoindex.md) | | <code>boolean</code> | prevents errors when index pattern exists before indices |
|
||||||
| [deleteFieldFormat](./kibana-plugin-plugins-data-public.indexpattern.deletefieldformat.md) | | <code>(fieldName: string) => void</code> | |
|
| [deleteFieldFormat](./kibana-plugin-plugins-data-public.indexpattern.deletefieldformat.md) | | <code>(fieldName: string) => void</code> | |
|
||||||
| [fieldAttrs](./kibana-plugin-plugins-data-public.indexpattern.fieldattrs.md) | | <code>FieldAttrs</code> | |
|
| [fieldAttrs](./kibana-plugin-plugins-data-public.indexpattern.fieldattrs.md) | | <code>FieldAttrs</code> | |
|
||||||
| [fieldFormatMap](./kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md) | | <code>Record<string, any></code> | |
|
| [fieldFormatMap](./kibana-plugin-plugins-data-public.indexpattern.fieldformatmap.md) | | <code>Record<string, any></code> | |
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-public.indexpatternattributes.md) > [allowNoIndex](./kibana-plugin-plugins-data-public.indexpatternattributes.allownoindex.md)
|
||||||
|
|
||||||
|
## IndexPatternAttributes.allowNoIndex property
|
||||||
|
|
||||||
|
prevents errors when index pattern exists before indices
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
allowNoIndex?: boolean;
|
||||||
|
```
|
|
@ -14,6 +14,7 @@ export interface IndexPatternAttributes
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| [allowNoIndex](./kibana-plugin-plugins-data-public.indexpatternattributes.allownoindex.md) | <code>boolean</code> | prevents errors when index pattern exists before indices |
|
||||||
| [fieldAttrs](./kibana-plugin-plugins-data-public.indexpatternattributes.fieldattrs.md) | <code>string</code> | |
|
| [fieldAttrs](./kibana-plugin-plugins-data-public.indexpatternattributes.fieldattrs.md) | <code>string</code> | |
|
||||||
| [fieldFormatMap](./kibana-plugin-plugins-data-public.indexpatternattributes.fieldformatmap.md) | <code>string</code> | |
|
| [fieldFormatMap](./kibana-plugin-plugins-data-public.indexpatternattributes.fieldformatmap.md) | <code>string</code> | |
|
||||||
| [fields](./kibana-plugin-plugins-data-public.indexpatternattributes.fields.md) | <code>string</code> | |
|
| [fields](./kibana-plugin-plugins-data-public.indexpatternattributes.fields.md) | <code>string</code> | |
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [IndexPatternSpec](./kibana-plugin-plugins-data-public.indexpatternspec.md) > [allowNoIndex](./kibana-plugin-plugins-data-public.indexpatternspec.allownoindex.md)
|
||||||
|
|
||||||
|
## IndexPatternSpec.allowNoIndex property
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
allowNoIndex?: boolean;
|
||||||
|
```
|
|
@ -14,6 +14,7 @@ export interface IndexPatternSpec
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| [allowNoIndex](./kibana-plugin-plugins-data-public.indexpatternspec.allownoindex.md) | <code>boolean</code> | |
|
||||||
| [fieldAttrs](./kibana-plugin-plugins-data-public.indexpatternspec.fieldattrs.md) | <code>FieldAttrs</code> | |
|
| [fieldAttrs](./kibana-plugin-plugins-data-public.indexpatternspec.fieldattrs.md) | <code>FieldAttrs</code> | |
|
||||||
| [fieldFormats](./kibana-plugin-plugins-data-public.indexpatternspec.fieldformats.md) | <code>Record<string, SerializedFieldFormat></code> | |
|
| [fieldFormats](./kibana-plugin-plugins-data-public.indexpatternspec.fieldformats.md) | <code>Record<string, SerializedFieldFormat></code> | |
|
||||||
| [fields](./kibana-plugin-plugins-data-public.indexpatternspec.fields.md) | <code>IndexPatternFieldMap</code> | |
|
| [fields](./kibana-plugin-plugins-data-public.indexpatternspec.fields.md) | <code>IndexPatternFieldMap</code> | |
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPattern](./kibana-plugin-plugins-data-server.indexpattern.md) > [allowNoIndex](./kibana-plugin-plugins-data-server.indexpattern.allownoindex.md)
|
||||||
|
|
||||||
|
## IndexPattern.allowNoIndex property
|
||||||
|
|
||||||
|
prevents errors when index pattern exists before indices
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
readonly allowNoIndex: boolean;
|
||||||
|
```
|
|
@ -19,6 +19,7 @@ getAsSavedObjectBody(): {
|
||||||
fieldFormatMap: string | undefined;
|
fieldFormatMap: string | undefined;
|
||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
typeMeta: string | undefined;
|
typeMeta: string | undefined;
|
||||||
|
allowNoIndex: true | undefined;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
@ -33,5 +34,6 @@ getAsSavedObjectBody(): {
|
||||||
fieldFormatMap: string | undefined;
|
fieldFormatMap: string | undefined;
|
||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
typeMeta: string | undefined;
|
typeMeta: string | undefined;
|
||||||
|
allowNoIndex: true | undefined;
|
||||||
}`
|
}`
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ export declare class IndexPattern implements IIndexPattern
|
||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
| Property | Modifiers | Type | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
|
| [allowNoIndex](./kibana-plugin-plugins-data-server.indexpattern.allownoindex.md) | | <code>boolean</code> | prevents errors when index pattern exists before indices |
|
||||||
| [deleteFieldFormat](./kibana-plugin-plugins-data-server.indexpattern.deletefieldformat.md) | | <code>(fieldName: string) => void</code> | |
|
| [deleteFieldFormat](./kibana-plugin-plugins-data-server.indexpattern.deletefieldformat.md) | | <code>(fieldName: string) => void</code> | |
|
||||||
| [fieldAttrs](./kibana-plugin-plugins-data-server.indexpattern.fieldattrs.md) | | <code>FieldAttrs</code> | |
|
| [fieldAttrs](./kibana-plugin-plugins-data-server.indexpattern.fieldattrs.md) | | <code>FieldAttrs</code> | |
|
||||||
| [fieldFormatMap](./kibana-plugin-plugins-data-server.indexpattern.fieldformatmap.md) | | <code>Record<string, any></code> | |
|
| [fieldFormatMap](./kibana-plugin-plugins-data-server.indexpattern.fieldformatmap.md) | | <code>Record<string, any></code> | |
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [kibana-plugin-plugins-data-server](./kibana-plugin-plugins-data-server.md) > [IndexPatternAttributes](./kibana-plugin-plugins-data-server.indexpatternattributes.md) > [allowNoIndex](./kibana-plugin-plugins-data-server.indexpatternattributes.allownoindex.md)
|
||||||
|
|
||||||
|
## IndexPatternAttributes.allowNoIndex property
|
||||||
|
|
||||||
|
prevents errors when index pattern exists before indices
|
||||||
|
|
||||||
|
<b>Signature:</b>
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
allowNoIndex?: boolean;
|
||||||
|
```
|
|
@ -14,6 +14,7 @@ export interface IndexPatternAttributes
|
||||||
|
|
||||||
| Property | Type | Description |
|
| Property | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
|
| [allowNoIndex](./kibana-plugin-plugins-data-server.indexpatternattributes.allownoindex.md) | <code>boolean</code> | prevents errors when index pattern exists before indices |
|
||||||
| [fieldAttrs](./kibana-plugin-plugins-data-server.indexpatternattributes.fieldattrs.md) | <code>string</code> | |
|
| [fieldAttrs](./kibana-plugin-plugins-data-server.indexpatternattributes.fieldattrs.md) | <code>string</code> | |
|
||||||
| [fieldFormatMap](./kibana-plugin-plugins-data-server.indexpatternattributes.fieldformatmap.md) | <code>string</code> | |
|
| [fieldFormatMap](./kibana-plugin-plugins-data-server.indexpatternattributes.fieldformatmap.md) | <code>string</code> | |
|
||||||
| [fields](./kibana-plugin-plugins-data-server.indexpatternattributes.fields.md) | <code>string</code> | |
|
| [fields](./kibana-plugin-plugins-data-server.indexpatternattributes.fields.md) | <code>string</code> | |
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
exports[`IndexPattern toSpec should match snapshot 1`] = `
|
exports[`IndexPattern toSpec should match snapshot 1`] = `
|
||||||
Object {
|
Object {
|
||||||
|
"allowNoIndex": false,
|
||||||
"fieldAttrs": Object {},
|
"fieldAttrs": Object {},
|
||||||
"fieldFormats": Object {},
|
"fieldFormats": Object {},
|
||||||
"fields": Object {
|
"fields": Object {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
exports[`IndexPatterns savedObjectToSpec 1`] = `
|
exports[`IndexPatterns savedObjectToSpec 1`] = `
|
||||||
Object {
|
Object {
|
||||||
|
"allowNoIndex": undefined,
|
||||||
"fieldAttrs": Object {},
|
"fieldAttrs": Object {},
|
||||||
"fieldFormats": Object {
|
"fieldFormats": Object {
|
||||||
"field": Object {},
|
"field": Object {},
|
||||||
|
|
|
@ -74,6 +74,10 @@ export class IndexPattern implements IIndexPattern {
|
||||||
private fieldFormats: FieldFormatsStartCommon;
|
private fieldFormats: FieldFormatsStartCommon;
|
||||||
// make private once manual field refresh is removed
|
// make private once manual field refresh is removed
|
||||||
public fieldAttrs: FieldAttrs;
|
public fieldAttrs: FieldAttrs;
|
||||||
|
/**
|
||||||
|
* prevents errors when index pattern exists before indices
|
||||||
|
*/
|
||||||
|
public readonly allowNoIndex: boolean = false;
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
spec = {},
|
spec = {},
|
||||||
|
@ -110,6 +114,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
this.typeMeta = spec.typeMeta;
|
this.typeMeta = spec.typeMeta;
|
||||||
this.fieldAttrs = spec.fieldAttrs || {};
|
this.fieldAttrs = spec.fieldAttrs || {};
|
||||||
this.intervalName = spec.intervalName;
|
this.intervalName = spec.intervalName;
|
||||||
|
this.allowNoIndex = spec.allowNoIndex || false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,6 +209,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
fieldFormats: this.fieldFormatMap,
|
fieldFormats: this.fieldFormatMap,
|
||||||
fieldAttrs: this.fieldAttrs,
|
fieldAttrs: this.fieldAttrs,
|
||||||
intervalName: this.intervalName,
|
intervalName: this.intervalName,
|
||||||
|
allowNoIndex: this.allowNoIndex,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +315,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
fieldFormatMap,
|
fieldFormatMap,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
typeMeta: this.typeMeta ? JSON.stringify(this.typeMeta) : undefined,
|
typeMeta: this.typeMeta ? JSON.stringify(this.typeMeta) : undefined,
|
||||||
|
allowNoIndex: this.allowNoIndex ? this.allowNoIndex : undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,21 @@ describe('IndexPatterns', () => {
|
||||||
SOClientGetDelay = 0;
|
SOClientGetDelay = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('allowNoIndex flag preserves existing fields when index is missing', async () => {
|
||||||
|
const id = '2';
|
||||||
|
setDocsourcePayload(id, {
|
||||||
|
id: 'foo',
|
||||||
|
version: 'foo',
|
||||||
|
attributes: {
|
||||||
|
title: 'something',
|
||||||
|
allowNoIndex: true,
|
||||||
|
fields: '[{"name":"field"}]',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect((await indexPatterns.get(id)).fields.length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
test('savedObjectCache pre-fetches only title', async () => {
|
test('savedObjectCache pre-fetches only title', async () => {
|
||||||
expect(await indexPatterns.getIds()).toEqual(['id']);
|
expect(await indexPatterns.getIds()).toEqual(['id']);
|
||||||
expect(savedObjectsClient.find).toHaveBeenCalledWith({
|
expect(savedObjectsClient.find).toHaveBeenCalledWith({
|
||||||
|
|
|
@ -222,6 +222,7 @@ export class IndexPatternsService {
|
||||||
metaFields,
|
metaFields,
|
||||||
type: options.type,
|
type: options.type,
|
||||||
rollupIndex: options.rollupIndex,
|
rollupIndex: options.rollupIndex,
|
||||||
|
allowNoIndex: options.allowNoIndex,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -281,10 +282,21 @@ export class IndexPatternsService {
|
||||||
options: GetFieldsOptions,
|
options: GetFieldsOptions,
|
||||||
fieldAttrs: FieldAttrs = {}
|
fieldAttrs: FieldAttrs = {}
|
||||||
) => {
|
) => {
|
||||||
const scriptedFields = Object.values(fields).filter((field) => field.scripted);
|
const fieldsAsArr = Object.values(fields);
|
||||||
|
const scriptedFields = fieldsAsArr.filter((field) => field.scripted);
|
||||||
try {
|
try {
|
||||||
|
let updatedFieldList: FieldSpec[];
|
||||||
const newFields = (await this.getFieldsForWildcard(options)) as FieldSpec[];
|
const newFields = (await this.getFieldsForWildcard(options)) as FieldSpec[];
|
||||||
return this.fieldArrayToMap([...newFields, ...scriptedFields], fieldAttrs);
|
|
||||||
|
// If allowNoIndex, only update field list if field caps finds fields. To support
|
||||||
|
// beats creating index pattern and dashboard before docs
|
||||||
|
if (!options.allowNoIndex || (newFields && newFields.length > 5)) {
|
||||||
|
updatedFieldList = [...newFields, ...scriptedFields];
|
||||||
|
} else {
|
||||||
|
updatedFieldList = fieldsAsArr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.fieldArrayToMap(updatedFieldList, fieldAttrs);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof IndexPatternMissingIndices) {
|
if (err instanceof IndexPatternMissingIndices) {
|
||||||
this.onNotification({ title: (err as any).message, color: 'danger', iconType: 'alert' });
|
this.onNotification({ title: (err as any).message, color: 'danger', iconType: 'alert' });
|
||||||
|
@ -334,6 +346,7 @@ export class IndexPatternsService {
|
||||||
typeMeta,
|
typeMeta,
|
||||||
type,
|
type,
|
||||||
fieldAttrs,
|
fieldAttrs,
|
||||||
|
allowNoIndex,
|
||||||
},
|
},
|
||||||
} = savedObject;
|
} = savedObject;
|
||||||
|
|
||||||
|
@ -355,6 +368,7 @@ export class IndexPatternsService {
|
||||||
type,
|
type,
|
||||||
fieldFormats: parsedFieldFormatMap,
|
fieldFormats: parsedFieldFormatMap,
|
||||||
fieldAttrs: parsedFieldAttrs,
|
fieldAttrs: parsedFieldAttrs,
|
||||||
|
allowNoIndex,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -384,6 +398,7 @@ export class IndexPatternsService {
|
||||||
metaFields: await this.config.get(UI_SETTINGS.META_FIELDS),
|
metaFields: await this.config.get(UI_SETTINGS.META_FIELDS),
|
||||||
type,
|
type,
|
||||||
rollupIndex: typeMeta?.params?.rollup_index,
|
rollupIndex: typeMeta?.params?.rollup_index,
|
||||||
|
allowNoIndex: spec.allowNoIndex,
|
||||||
},
|
},
|
||||||
spec.fieldAttrs
|
spec.fieldAttrs
|
||||||
);
|
);
|
||||||
|
|
|
@ -49,6 +49,10 @@ export interface IndexPatternAttributes {
|
||||||
sourceFilters?: string;
|
sourceFilters?: string;
|
||||||
fieldFormatMap?: string;
|
fieldFormatMap?: string;
|
||||||
fieldAttrs?: string;
|
fieldAttrs?: string;
|
||||||
|
/**
|
||||||
|
* prevents errors when index pattern exists before indices
|
||||||
|
*/
|
||||||
|
allowNoIndex?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FieldAttrs {
|
export interface FieldAttrs {
|
||||||
|
@ -101,6 +105,7 @@ export interface GetFieldsOptions {
|
||||||
lookBack?: boolean;
|
lookBack?: boolean;
|
||||||
metaFields?: string[];
|
metaFields?: string[];
|
||||||
rollupIndex?: string;
|
rollupIndex?: string;
|
||||||
|
allowNoIndex?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GetFieldsOptionsTimePattern {
|
export interface GetFieldsOptionsTimePattern {
|
||||||
|
@ -193,6 +198,7 @@ export interface IndexPatternSpec {
|
||||||
type?: string;
|
type?: string;
|
||||||
fieldFormats?: Record<string, SerializedFieldFormat>;
|
fieldFormats?: Record<string, SerializedFieldFormat>;
|
||||||
fieldAttrs?: FieldAttrs;
|
fieldAttrs?: FieldAttrs;
|
||||||
|
allowNoIndex?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SourceFilter {
|
export interface SourceFilter {
|
||||||
|
|
|
@ -64,12 +64,13 @@ export class IndexPatternsApiClient implements IIndexPatternsApiClient {
|
||||||
}).then((resp: any) => resp.fields);
|
}).then((resp: any) => resp.fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFieldsForWildcard({ pattern, metaFields, type, rollupIndex }: GetFieldsOptions) {
|
getFieldsForWildcard({ pattern, metaFields, type, rollupIndex, allowNoIndex }: GetFieldsOptions) {
|
||||||
return this._request(this._getUrl(['_fields_for_wildcard']), {
|
return this._request(this._getUrl(['_fields_for_wildcard']), {
|
||||||
pattern,
|
pattern,
|
||||||
meta_fields: metaFields,
|
meta_fields: metaFields,
|
||||||
type,
|
type,
|
||||||
rollup_index: rollupIndex,
|
rollup_index: rollupIndex,
|
||||||
}).then((resp: any) => resp.fields);
|
allow_no_index: allowNoIndex,
|
||||||
|
}).then((resp: any) => resp.fields || []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1256,6 +1256,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
|
||||||
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
|
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
|
||||||
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
|
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
|
||||||
|
readonly allowNoIndex: boolean;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
readonly deleteFieldFormat: (fieldName: string) => void;
|
readonly deleteFieldFormat: (fieldName: string) => void;
|
||||||
// Warning: (ae-forgotten-export) The symbol "FieldAttrs" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "FieldAttrs" needs to be exported by the entry point index.d.ts
|
||||||
|
@ -1296,6 +1297,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
fieldFormatMap: string | undefined;
|
fieldFormatMap: string | undefined;
|
||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
typeMeta: string | undefined;
|
typeMeta: string | undefined;
|
||||||
|
allowNoIndex: true | undefined;
|
||||||
};
|
};
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
getComputedFields(): {
|
getComputedFields(): {
|
||||||
|
@ -1388,6 +1390,7 @@ export type IndexPatternAggRestrictions = Record<string, {
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export interface IndexPatternAttributes {
|
export interface IndexPatternAttributes {
|
||||||
|
allowNoIndex?: boolean;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
fieldAttrs?: string;
|
fieldAttrs?: string;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
|
@ -1518,6 +1521,8 @@ export type IndexPatternSelectProps = Required<Omit<EuiComboBoxProps<any>, 'isLo
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export interface IndexPatternSpec {
|
export interface IndexPatternSpec {
|
||||||
|
// (undocumented)
|
||||||
|
allowNoIndex?: boolean;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
fieldAttrs?: FieldAttrs;
|
fieldAttrs?: FieldAttrs;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
|
@ -2564,7 +2569,7 @@ export const UI_SETTINGS: {
|
||||||
// src/plugins/data/common/es_query/filters/phrase_filter.ts:33:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/es_query/filters/phrase_filter.ts:33:3 - (ae-forgotten-export) The symbol "PhraseFilterMeta" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/es_query/filters/phrases_filter.ts:31:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/es_query/filters/phrases_filter.ts:31:3 - (ae-forgotten-export) The symbol "PhrasesFilterMeta" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:64:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:64:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:128:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:133:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/search/aggs/types.ts:150:51 - (ae-forgotten-export) The symbol "AggTypesRegistryStart" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/search/aggs/types.ts:150:51 - (ae-forgotten-export) The symbol "AggTypesRegistryStart" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/search/search_source/search_source.ts:197:7 - (ae-forgotten-export) The symbol "SearchFieldValue" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/search/search_source/search_source.ts:197:7 - (ae-forgotten-export) The symbol "SearchFieldValue" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/public/field_formats/field_formats_service.ts:67:3 - (ae-forgotten-export) The symbol "FormatFactory" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/public/field_formats/field_formats_service.ts:67:3 - (ae-forgotten-export) The symbol "FormatFactory" needs to be exported by the entry point index.d.ts
|
||||||
|
|
|
@ -30,8 +30,14 @@ export class IndexPatternsApiServer implements IIndexPatternsApiClient {
|
||||||
constructor(elasticsearchClient: ElasticsearchClient) {
|
constructor(elasticsearchClient: ElasticsearchClient) {
|
||||||
this.esClient = elasticsearchClient;
|
this.esClient = elasticsearchClient;
|
||||||
}
|
}
|
||||||
async getFieldsForWildcard({ pattern, metaFields, type, rollupIndex }: GetFieldsOptions) {
|
async getFieldsForWildcard({
|
||||||
const indexPatterns = new IndexPatternsFetcher(this.esClient);
|
pattern,
|
||||||
|
metaFields,
|
||||||
|
type,
|
||||||
|
rollupIndex,
|
||||||
|
allowNoIndex,
|
||||||
|
}: GetFieldsOptions) {
|
||||||
|
const indexPatterns = new IndexPatternsFetcher(this.esClient, allowNoIndex);
|
||||||
return await indexPatterns.getFieldsForWildcard({
|
return await indexPatterns.getFieldsForWildcard({
|
||||||
pattern,
|
pattern,
|
||||||
metaFields,
|
metaFields,
|
||||||
|
|
|
@ -75,13 +75,20 @@ export function registerRoutes(
|
||||||
}),
|
}),
|
||||||
type: schema.maybe(schema.string()),
|
type: schema.maybe(schema.string()),
|
||||||
rollup_index: schema.maybe(schema.string()),
|
rollup_index: schema.maybe(schema.string()),
|
||||||
|
allow_no_index: schema.maybe(schema.boolean()),
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
async (context, request, response) => {
|
async (context, request, response) => {
|
||||||
const { asCurrentUser } = context.core.elasticsearch.client;
|
const { asCurrentUser } = context.core.elasticsearch.client;
|
||||||
const indexPatterns = new IndexPatternsFetcher(asCurrentUser);
|
const indexPatterns = new IndexPatternsFetcher(asCurrentUser);
|
||||||
const { pattern, meta_fields: metaFields, type, rollup_index: rollupIndex } = request.query;
|
const {
|
||||||
|
pattern,
|
||||||
|
meta_fields: metaFields,
|
||||||
|
type,
|
||||||
|
rollup_index: rollupIndex,
|
||||||
|
allow_no_index: allowNoIndex,
|
||||||
|
} = request.query;
|
||||||
|
|
||||||
let parsedFields: string[] = [];
|
let parsedFields: string[] = [];
|
||||||
try {
|
try {
|
||||||
|
@ -96,6 +103,9 @@ export function registerRoutes(
|
||||||
metaFields: parsedFields,
|
metaFields: parsedFields,
|
||||||
type,
|
type,
|
||||||
rollupIndex,
|
rollupIndex,
|
||||||
|
fieldCapsOptions: {
|
||||||
|
allow_no_indices: allowNoIndex || false,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
return response.ok({
|
return response.ok({
|
||||||
|
|
|
@ -50,6 +50,7 @@ const indexPatternSpecSchema = schema.object({
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
allowNoIndex: schema.maybe(schema.boolean()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const registerCreateIndexPatternRoute = (
|
export const registerCreateIndexPatternRoute = (
|
||||||
|
|
|
@ -38,6 +38,7 @@ const indexPatternUpdateSchema = schema.object({
|
||||||
),
|
),
|
||||||
fieldFormats: schema.maybe(schema.recordOf(schema.string(), serializedFieldFormatSchema)),
|
fieldFormats: schema.maybe(schema.recordOf(schema.string(), serializedFieldFormatSchema)),
|
||||||
fields: schema.maybe(schema.recordOf(schema.string(), fieldSpecSchema)),
|
fields: schema.maybe(schema.recordOf(schema.string(), fieldSpecSchema)),
|
||||||
|
allowNoIndex: schema.maybe(schema.boolean()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const registerUpdateIndexPatternRoute = (
|
export const registerUpdateIndexPatternRoute = (
|
||||||
|
|
|
@ -94,4 +94,55 @@ Object {
|
||||||
expect(migrationFn(input, savedObjectMigrationContext)).toEqual(expected);
|
expect(migrationFn(input, savedObjectMigrationContext)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('7.11.0', () => {
|
||||||
|
const migrationFn = indexPatternSavedObjectTypeMigrations['7.11.0'];
|
||||||
|
|
||||||
|
test('should set allowNoIndex', () => {
|
||||||
|
const input = {
|
||||||
|
type: 'index-pattern',
|
||||||
|
id: 'logs-*',
|
||||||
|
attributes: {},
|
||||||
|
};
|
||||||
|
const expected = {
|
||||||
|
type: 'index-pattern',
|
||||||
|
id: 'logs-*',
|
||||||
|
attributes: {
|
||||||
|
allowNoIndex: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(migrationFn(input, savedObjectMigrationContext)).toEqual(expected);
|
||||||
|
|
||||||
|
const input2 = {
|
||||||
|
type: 'index-pattern',
|
||||||
|
id: 'metrics-*',
|
||||||
|
attributes: {},
|
||||||
|
};
|
||||||
|
const expected2 = {
|
||||||
|
type: 'index-pattern',
|
||||||
|
id: 'metrics-*',
|
||||||
|
attributes: {
|
||||||
|
allowNoIndex: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(migrationFn(input2, savedObjectMigrationContext)).toEqual(expected2);
|
||||||
|
|
||||||
|
const input3 = {
|
||||||
|
type: 'index-pattern',
|
||||||
|
id: 'xxx',
|
||||||
|
attributes: {},
|
||||||
|
};
|
||||||
|
const expected3 = {
|
||||||
|
type: 'index-pattern',
|
||||||
|
id: 'xxx',
|
||||||
|
attributes: {
|
||||||
|
allowNoIndex: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(migrationFn(input3, savedObjectMigrationContext)).toEqual(expected3);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,7 +54,16 @@ const migrateSubTypeAndParentFieldProperties: SavedObjectMigrationFn<any, any> =
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const addAllowNoIndex: SavedObjectMigrationFn<any, any> = (doc) => ({
|
||||||
|
...doc,
|
||||||
|
attributes: {
|
||||||
|
...doc.attributes,
|
||||||
|
allowNoIndex: doc.id === 'logs-*' || doc.id === 'metrics-*' || undefined,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export const indexPatternSavedObjectTypeMigrations = {
|
export const indexPatternSavedObjectTypeMigrations = {
|
||||||
'6.5.0': flow(migrateAttributeTypeAndAttributeTypeMeta),
|
'6.5.0': flow(migrateAttributeTypeAndAttributeTypeMeta),
|
||||||
'7.6.0': flow(migrateSubTypeAndParentFieldProperties),
|
'7.6.0': flow(migrateSubTypeAndParentFieldProperties),
|
||||||
|
'7.11.0': flow(addAllowNoIndex),
|
||||||
};
|
};
|
||||||
|
|
|
@ -689,6 +689,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
|
||||||
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
|
constructor({ spec, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
|
||||||
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
|
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
|
||||||
|
readonly allowNoIndex: boolean;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
readonly deleteFieldFormat: (fieldName: string) => void;
|
readonly deleteFieldFormat: (fieldName: string) => void;
|
||||||
// Warning: (ae-forgotten-export) The symbol "FieldAttrs" needs to be exported by the entry point index.d.ts
|
// Warning: (ae-forgotten-export) The symbol "FieldAttrs" needs to be exported by the entry point index.d.ts
|
||||||
|
@ -731,6 +732,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
fieldFormatMap: string | undefined;
|
fieldFormatMap: string | undefined;
|
||||||
type: string | undefined;
|
type: string | undefined;
|
||||||
typeMeta: string | undefined;
|
typeMeta: string | undefined;
|
||||||
|
allowNoIndex: true | undefined;
|
||||||
};
|
};
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
getComputedFields(): {
|
getComputedFields(): {
|
||||||
|
@ -819,6 +821,7 @@ export class IndexPattern implements IIndexPattern {
|
||||||
//
|
//
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export interface IndexPatternAttributes {
|
export interface IndexPatternAttributes {
|
||||||
|
allowNoIndex?: boolean;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
fieldAttrs?: string;
|
fieldAttrs?: string;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
|
@ -1388,7 +1391,7 @@ export function usageProvider(core: CoreSetup_2): SearchUsage;
|
||||||
// src/plugins/data/common/es_query/filters/meta_filter.ts:54:3 - (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/es_query/filters/meta_filter.ts:54:3 - (ae-forgotten-export) The symbol "FilterMeta" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:58:45 - (ae-forgotten-export) The symbol "IndexPatternFieldMap" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:58:45 - (ae-forgotten-export) The symbol "IndexPatternFieldMap" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:64:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:64:5 - (ae-forgotten-export) The symbol "FormatFieldFn" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:128:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/common/index_patterns/index_patterns/index_pattern.ts:133:7 - (ae-forgotten-export) The symbol "FieldAttrSet" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/server/index.ts:40:23 - (ae-forgotten-export) The symbol "buildCustomFilter" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/server/index.ts:40:23 - (ae-forgotten-export) The symbol "buildCustomFilter" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/server/index.ts:40:23 - (ae-forgotten-export) The symbol "buildFilter" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/server/index.ts:40:23 - (ae-forgotten-export) The symbol "buildFilter" needs to be exported by the entry point index.d.ts
|
||||||
// src/plugins/data/server/index.ts:57:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts
|
// src/plugins/data/server/index.ts:57:23 - (ae-forgotten-export) The symbol "datatableToCSV" needs to be exported by the entry point index.d.ts
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-packages';
|
export const PACKAGES_SAVED_OBJECT_TYPE = 'epm-packages';
|
||||||
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = 'index-pattern';
|
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = 'index-pattern';
|
||||||
export const INDEX_PATTERN_PLACEHOLDER_SUFFIX = '-index_pattern_placeholder';
|
|
||||||
export const MAX_TIME_COMPLETE_INSTALL = 60000;
|
export const MAX_TIME_COMPLETE_INSTALL = 60000;
|
||||||
|
|
||||||
export const requiredPackages = {
|
export const requiredPackages = {
|
||||||
|
|
|
@ -14,7 +14,6 @@ export {
|
||||||
AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
|
AGENT_POLICY_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
|
||||||
AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
|
AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
|
||||||
AGENT_UPDATE_ACTIONS_INTERVAL_MS,
|
AGENT_UPDATE_ACTIONS_INTERVAL_MS,
|
||||||
INDEX_PATTERN_PLACEHOLDER_SUFFIX,
|
|
||||||
MAX_TIME_COMPLETE_INSTALL,
|
MAX_TIME_COMPLETE_INSTALL,
|
||||||
// Routes
|
// Routes
|
||||||
LIMITED_CONCURRENCY_ROUTE_TAG,
|
LIMITED_CONCURRENCY_ROUTE_TAG,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -5,15 +5,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { SavedObjectsClientContract } from 'src/core/server';
|
import { SavedObjectsClientContract } from 'src/core/server';
|
||||||
import {
|
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../../constants';
|
||||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
|
||||||
INDEX_PATTERN_PLACEHOLDER_SUFFIX,
|
|
||||||
} from '../../../../constants';
|
|
||||||
import { loadFieldsFromYaml, Fields, Field } from '../../fields/field';
|
import { loadFieldsFromYaml, Fields, Field } from '../../fields/field';
|
||||||
import { dataTypes, installationStatuses } from '../../../../../common/constants';
|
import { dataTypes, installationStatuses } from '../../../../../common/constants';
|
||||||
import { ArchivePackage, InstallSource, ValueOf } from '../../../../../common/types';
|
import { ArchivePackage, InstallSource, ValueOf } from '../../../../../common/types';
|
||||||
import { RegistryPackage, CallESAsCurrentUser, DataType } from '../../../../types';
|
import { RegistryPackage, DataType } from '../../../../types';
|
||||||
import { appContextService } from '../../../../services';
|
|
||||||
import { getPackageFromSource, getPackageSavedObjects } from '../../packages/get';
|
import { getPackageFromSource, getPackageSavedObjects } from '../../packages/get';
|
||||||
|
|
||||||
interface FieldFormatMap {
|
interface FieldFormatMap {
|
||||||
|
@ -172,6 +168,7 @@ export const createIndexPattern = (indexPatternType: string, fields: Fields) =>
|
||||||
timeFieldName: '@timestamp',
|
timeFieldName: '@timestamp',
|
||||||
fields: JSON.stringify(indexPatternFields),
|
fields: JSON.stringify(indexPatternFields),
|
||||||
fieldFormatMap: JSON.stringify(fieldFormatMap),
|
fieldFormatMap: JSON.stringify(fieldFormatMap),
|
||||||
|
allowNoIndex: true,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -382,31 +379,3 @@ const getFieldFormatParams = (field: Field): FieldFormatParams => {
|
||||||
if (field.open_link_in_current_tab) params.openLinkInCurrentTab = field.open_link_in_current_tab;
|
if (field.open_link_in_current_tab) params.openLinkInCurrentTab = field.open_link_in_current_tab;
|
||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ensureDefaultIndices = async (callCluster: CallESAsCurrentUser) => {
|
|
||||||
// create placeholder indices to supress errors in the kibana Dashboards app
|
|
||||||
// that no matching indices exist https://github.com/elastic/kibana/issues/62343
|
|
||||||
const logger = appContextService.getLogger();
|
|
||||||
return Promise.all(
|
|
||||||
Object.values(dataTypes).map(async (indexPattern) => {
|
|
||||||
const defaultIndexPatternName = indexPattern + INDEX_PATTERN_PLACEHOLDER_SUFFIX;
|
|
||||||
const indexExists = await callCluster('indices.exists', { index: defaultIndexPatternName });
|
|
||||||
if (!indexExists) {
|
|
||||||
try {
|
|
||||||
await callCluster('indices.create', {
|
|
||||||
index: defaultIndexPatternName,
|
|
||||||
body: {
|
|
||||||
mappings: {
|
|
||||||
properties: {
|
|
||||||
'@timestamp': { type: 'date' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} catch (putErr) {
|
|
||||||
logger.error(`${defaultIndexPatternName} could not be created`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import {
|
||||||
ensureInstalledDefaultPackages,
|
ensureInstalledDefaultPackages,
|
||||||
ensurePackagesCompletedInstall,
|
ensurePackagesCompletedInstall,
|
||||||
} from './epm/packages/install';
|
} from './epm/packages/install';
|
||||||
import { ensureDefaultIndices } from './epm/kibana/index_pattern/install';
|
|
||||||
import {
|
import {
|
||||||
packageToPackagePolicy,
|
packageToPackagePolicy,
|
||||||
PackagePolicy,
|
PackagePolicy,
|
||||||
|
@ -58,7 +57,6 @@ async function createSetupSideEffects(
|
||||||
ensureInstalledDefaultPackages(soClient, callCluster),
|
ensureInstalledDefaultPackages(soClient, callCluster),
|
||||||
outputService.ensureDefaultOutput(soClient),
|
outputService.ensureDefaultOutput(soClient),
|
||||||
agentPolicyService.ensureDefaultAgentPolicy(soClient),
|
agentPolicyService.ensureDefaultAgentPolicy(soClient),
|
||||||
ensureDefaultIndices(callCluster),
|
|
||||||
settingsService.getSettings(soClient).catch((e: any) => {
|
settingsService.getSettings(soClient).catch((e: any) => {
|
||||||
if (e.isBoom && e.output.statusCode === 404) {
|
if (e.isBoom && e.output.statusCode === 404) {
|
||||||
const defaultSettings = createDefaultSettings();
|
const defaultSettings = createDefaultSettings();
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
export default function ({ loadTestFile }) {
|
export default function ({ loadTestFile }) {
|
||||||
describe('Fleet Endpoints', function () {
|
describe('Fleet Endpoints', function () {
|
||||||
this.tags('ciGroup10');
|
this.tags('ciGroup10');
|
||||||
// Fleet setup
|
|
||||||
loadTestFile(require.resolve('./setup'));
|
|
||||||
// Agent setup
|
// Agent setup
|
||||||
loadTestFile(require.resolve('./agents_setup'));
|
loadTestFile(require.resolve('./agents_setup'));
|
||||||
// Agents
|
// Agents
|
||||||
|
|
|
@ -1,32 +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;
|
|
||||||
* you may not use this file except in compliance with the Elastic License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import expect from '@kbn/expect';
|
|
||||||
import { FtrProviderContext } from '../../api_integration/ftr_provider_context';
|
|
||||||
|
|
||||||
export default function (providerContext: FtrProviderContext) {
|
|
||||||
const { getService } = providerContext;
|
|
||||||
const supertest = getService('supertest');
|
|
||||||
const es = getService('es');
|
|
||||||
describe('Fleet setup', async () => {
|
|
||||||
before(async () => {
|
|
||||||
await supertest.post(`/api/fleet/setup`).set('kbn-xsrf', 'xxx').send();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should have installed placeholder indices', async function () {
|
|
||||||
const resLogsIndexPatternPlaceholder = await es.transport.request({
|
|
||||||
method: 'GET',
|
|
||||||
path: `/logs-index_pattern_placeholder`,
|
|
||||||
});
|
|
||||||
expect(resLogsIndexPatternPlaceholder.statusCode).equal(200);
|
|
||||||
const resMetricsIndexPatternPlaceholder = await es.transport.request({
|
|
||||||
method: 'GET',
|
|
||||||
path: `/metrics-index_pattern_placeholder`,
|
|
||||||
});
|
|
||||||
expect(resMetricsIndexPatternPlaceholder.statusCode).equal(200);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -13,19 +13,32 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||||
const esArchiver = getService('esArchiver');
|
const esArchiver = getService('esArchiver');
|
||||||
const browser = getService('browser');
|
const browser = getService('browser');
|
||||||
|
|
||||||
describe('Endpoint Event Resolver', function () {
|
/**
|
||||||
|
* Navigating to the hosts page must be done after data is loaded into ES otherwise
|
||||||
|
* the hosts page will display the empty default page and if we load data after that
|
||||||
|
* we'd have to set the source filter on the page.
|
||||||
|
*/
|
||||||
|
const navigateToHostsAndSetDate = async () => {
|
||||||
|
await pageObjects.hosts.navigateToSecurityHostsPage();
|
||||||
|
await pageObjects.common.dismissBanner();
|
||||||
|
const fromTime = 'Jan 1, 2018 @ 00:00:00.000';
|
||||||
|
const toTime = 'now';
|
||||||
|
await pageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
|
||||||
|
};
|
||||||
|
|
||||||
|
describe.skip('Endpoint Event Resolver', function () {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await pageObjects.hosts.navigateToSecurityHostsPage();
|
|
||||||
await pageObjects.common.dismissBanner();
|
|
||||||
const fromTime = 'Jan 1, 2018 @ 00:00:00.000';
|
|
||||||
const toTime = 'now';
|
|
||||||
await pageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
|
|
||||||
await browser.setWindowSize(1800, 1200);
|
await browser.setWindowSize(1800, 1200);
|
||||||
});
|
});
|
||||||
describe.skip('Endpoint Resolver Tree', function () {
|
after(async () => {
|
||||||
|
await pageObjects.hosts.deleteDataStreams();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Endpoint Resolver Tree', function () {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await esArchiver.load('empty_kibana');
|
await esArchiver.load('empty_kibana');
|
||||||
await esArchiver.load('endpoint/resolver_tree/functions', { useCreate: true });
|
await esArchiver.load('endpoint/resolver_tree/functions', { useCreate: true });
|
||||||
|
await navigateToHostsAndSetDate();
|
||||||
await pageObjects.hosts.executeQueryAndOpenResolver('event.dataset : endpoint.events.file');
|
await pageObjects.hosts.executeQueryAndOpenResolver('event.dataset : endpoint.events.file');
|
||||||
});
|
});
|
||||||
after(async () => {
|
after(async () => {
|
||||||
|
@ -213,6 +226,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await esArchiver.load('empty_kibana');
|
await esArchiver.load('empty_kibana');
|
||||||
await esArchiver.load('endpoint/resolver_tree/alert_events', { useCreate: true });
|
await esArchiver.load('endpoint/resolver_tree/alert_events', { useCreate: true });
|
||||||
|
await navigateToHostsAndSetDate();
|
||||||
});
|
});
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await pageObjects.hosts.deleteDataStreams();
|
await pageObjects.hosts.deleteDataStreams();
|
||||||
|
|
|
@ -277,7 +277,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
.set('kbn-xsrf', 'xxx')
|
.set('kbn-xsrf', 'xxx')
|
||||||
.send({
|
.send({
|
||||||
filter: entityIDFilter,
|
filter: entityIDFilter,
|
||||||
indexPatterns: ['metrics-*'],
|
indexPatterns: ['doesnotexist-*'],
|
||||||
timeRange: {
|
timeRange: {
|
||||||
from: tree.startTime,
|
from: tree.startTime,
|
||||||
to: tree.endTime,
|
to: tree.endTime,
|
||||||
|
|
|
@ -281,7 +281,7 @@ export default function ({ getService }: FtrProviderContext) {
|
||||||
from: tree.startTime.toISOString(),
|
from: tree.startTime.toISOString(),
|
||||||
to: tree.endTime.toISOString(),
|
to: tree.endTime.toISOString(),
|
||||||
},
|
},
|
||||||
indexPatterns: ['metrics-*'],
|
indexPatterns: ['doesnotexist-*'],
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
expect(body).to.be.empty();
|
expect(body).to.be.empty();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue