mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[7.x] [TSVB] Fix references to the index pattern are not embedded when exporting a saved object (#103255) (#103508)
* [TSVB] Fix references to the index pattern are not embedded when exporting a saved object (#103255) * [TSVB] Importing a dashboard with only TSVB viz on another space, breaks the dashboard Closes: #103059 * move index-pattern to constant Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> * fix CI Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b92ce4d7d4
commit
98c5543866
25 changed files with 251 additions and 75 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) > [INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE](./kibana-plugin-plugins-data-public.index_pattern_saved_object_type.md)
|
||||
|
||||
## INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE variable
|
||||
|
||||
\*
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE = "index-pattern"
|
||||
```
|
|
@ -118,6 +118,7 @@
|
|||
| [fieldFormats](./kibana-plugin-plugins-data-public.fieldformats.md) | |
|
||||
| [fieldList](./kibana-plugin-plugins-data-public.fieldlist.md) | |
|
||||
| [getKbnTypeNames](./kibana-plugin-plugins-data-public.getkbntypenames.md) | Get the esTypes known by all kbnFieldTypes {<!-- -->Array<string>} |
|
||||
| [INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE](./kibana-plugin-plugins-data-public.index_pattern_saved_object_type.md) | \* |
|
||||
| [indexPatterns](./kibana-plugin-plugins-data-public.indexpatterns.md) | |
|
||||
| [injectSearchSourceReferences](./kibana-plugin-plugins-data-public.injectsearchsourcereferences.md) | |
|
||||
| [isCompleteResponse](./kibana-plugin-plugins-data-public.iscompleteresponse.md) | |
|
||||
|
|
|
@ -11,11 +11,11 @@ esFilters: {
|
|||
buildQueryFilter: (query: any, index: string, alias: string) => import("../common").QueryStringFilter;
|
||||
buildCustomFilter: typeof buildCustomFilter;
|
||||
buildEmptyFilter: (isPinned: boolean, index?: string | undefined) => import("../common").Filter;
|
||||
buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").MinimalIndexPattern) => import("../common").ExistsFilter;
|
||||
buildExistsFilter: (field: import("../common").IFieldType, indexPattern: import("../common").IndexPatternBase) => import("../common").ExistsFilter;
|
||||
buildFilter: typeof buildFilter;
|
||||
buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").MinimalIndexPattern) => import("../common").PhraseFilter;
|
||||
buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").MinimalIndexPattern) => import("../common").PhrasesFilter;
|
||||
buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").MinimalIndexPattern, formattedValue?: string | undefined) => import("../common").RangeFilter;
|
||||
buildPhraseFilter: (field: import("../common").IFieldType, value: any, indexPattern: import("../common").IndexPatternBase) => import("../common").PhraseFilter;
|
||||
buildPhrasesFilter: (field: import("../common").IFieldType, params: any[], indexPattern: import("../common").IndexPatternBase) => import("../common").PhrasesFilter;
|
||||
buildRangeFilter: (field: import("../common").IFieldType, params: import("../common").RangeFilterParams, indexPattern: import("../common").IndexPatternBase, formattedValue?: string | undefined) => import("../common").RangeFilter;
|
||||
isFilterDisabled: (filter: import("../common").Filter) => boolean;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
esKuery: {
|
||||
nodeTypes: import("../common/es_query/kuery/node_types").NodeTypes;
|
||||
fromKueryExpression: (expression: any, parseOptions?: Partial<import("../common").KueryParseOptions>) => import("../common").KueryNode;
|
||||
toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").MinimalIndexPattern | undefined, config?: Record<string, any> | undefined, context?: Record<string, any> | undefined) => import("@kbn/common-utils").JsonObject;
|
||||
toElasticsearchQuery: (node: import("../common").KueryNode, indexPattern?: import("../common").IndexPatternBase | undefined, config?: Record<string, any> | undefined, context?: Record<string, any> | undefined) => import("@kbn/common-utils").JsonObject;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
```typescript
|
||||
esQuery: {
|
||||
buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").MinimalIndexPattern | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => {
|
||||
buildQueryFromFilters: (filters: import("../common").Filter[] | undefined, indexPattern: import("../common").IndexPatternBase | undefined, ignoreFilterIfFieldNotInIndex?: boolean) => {
|
||||
must: never[];
|
||||
filter: import("../common").Filter[];
|
||||
should: never[];
|
||||
|
|
|
@ -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) > [INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE](./kibana-plugin-plugins-data-server.index_pattern_saved_object_type.md)
|
||||
|
||||
## INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE variable
|
||||
|
||||
\*
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE = "index-pattern"
|
||||
```
|
|
@ -83,6 +83,7 @@
|
|||
| [esQuery](./kibana-plugin-plugins-data-server.esquery.md) | |
|
||||
| [exporters](./kibana-plugin-plugins-data-server.exporters.md) | |
|
||||
| [fieldFormats](./kibana-plugin-plugins-data-server.fieldformats.md) | |
|
||||
| [INDEX\_PATTERN\_SAVED\_OBJECT\_TYPE](./kibana-plugin-plugins-data-server.index_pattern_saved_object_type.md) | \* |
|
||||
| [indexPatterns](./kibana-plugin-plugins-data-server.indexpatterns.md) | |
|
||||
| [mergeCapabilitiesWithFields](./kibana-plugin-plugins-data-server.mergecapabilitieswithfields.md) | |
|
||||
| [search](./kibana-plugin-plugins-data-server.search.md) | |
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
|
||||
import semver from 'semver';
|
||||
import { get, flow } from 'lodash';
|
||||
import { get, flow, identity } from 'lodash';
|
||||
import {
|
||||
SavedObjectAttributes,
|
||||
SavedObjectMigrationFn,
|
||||
|
@ -25,7 +25,9 @@ import {
|
|||
convertSavedDashboardPanelToPanelState,
|
||||
} from '../../common/embeddable/embeddable_saved_object_converters';
|
||||
import { SavedObjectEmbeddableInput } from '../../../embeddable/common';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../data/common';
|
||||
import { SerializableValue } from '../../../kibana_utils/common';
|
||||
import { replaceIndexPatternReference } from './replace_index_pattern_reference';
|
||||
|
||||
function migrateIndexPattern(doc: DashboardDoc700To720) {
|
||||
const searchSourceJSON = get(doc, 'attributes.kibanaSavedObjectMeta.searchSourceJSON');
|
||||
|
@ -43,7 +45,7 @@ function migrateIndexPattern(doc: DashboardDoc700To720) {
|
|||
searchSource.indexRefName = 'kibanaSavedObjectMeta.searchSourceJSON.index';
|
||||
doc.references.push({
|
||||
name: searchSource.indexRefName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: searchSource.index,
|
||||
});
|
||||
delete searchSource.index;
|
||||
|
@ -56,7 +58,7 @@ function migrateIndexPattern(doc: DashboardDoc700To720) {
|
|||
filterRow.meta.indexRefName = `kibanaSavedObjectMeta.searchSourceJSON.filter[${i}].meta.index`;
|
||||
doc.references.push({
|
||||
name: filterRow.meta.indexRefName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: filterRow.meta.index,
|
||||
});
|
||||
delete filterRow.meta.index;
|
||||
|
@ -214,12 +216,14 @@ export interface DashboardSavedObjectTypeMigrationsDeps {
|
|||
export const createDashboardSavedObjectTypeMigrations = (
|
||||
deps: DashboardSavedObjectTypeMigrationsDeps
|
||||
): SavedObjectMigrationMap => {
|
||||
const embeddableMigrations = deps.embeddable
|
||||
.getMigrationVersions()
|
||||
.filter((version) => semver.gt(version, '7.12.0'))
|
||||
.map((version): [string, SavedObjectMigrationFn] => {
|
||||
return [version, migrateByValuePanels(deps, version)];
|
||||
});
|
||||
const embeddableMigrations = Object.fromEntries(
|
||||
deps.embeddable
|
||||
.getMigrationVersions()
|
||||
.filter((version) => semver.gt(version, '7.12.0'))
|
||||
.map((version): [string, SavedObjectMigrationFn] => {
|
||||
return [version, migrateByValuePanels(deps, version)];
|
||||
})
|
||||
);
|
||||
|
||||
return {
|
||||
/**
|
||||
|
@ -237,12 +241,15 @@ export const createDashboardSavedObjectTypeMigrations = (
|
|||
'7.3.0': flow(migrations730),
|
||||
'7.9.3': flow(migrateMatchAllQuery),
|
||||
'7.11.0': flow(createExtractPanelReferencesMigration(deps)),
|
||||
...Object.fromEntries(embeddableMigrations),
|
||||
|
||||
...embeddableMigrations,
|
||||
|
||||
/**
|
||||
* Any dashboard saved object migrations that come after this point will have to be wary of
|
||||
* potentially overwriting embeddable migrations. An example of how to mitigate this follows:
|
||||
*/
|
||||
// '7.x': flow(yourNewMigrationFunction, embeddableMigrations['7.x'])
|
||||
// '7.x': flow(yourNewMigrationFunction, embeddableMigrations['7.x'] ?? identity),
|
||||
|
||||
'7.14.0': flow(replaceIndexPatternReference, embeddableMigrations['7.14.0'] ?? identity),
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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 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 type { SavedObjectMigrationContext, SavedObjectMigrationFn } from 'kibana/server';
|
||||
|
||||
import { replaceIndexPatternReference } from './replace_index_pattern_reference';
|
||||
|
||||
describe('replaceIndexPatternReference', () => {
|
||||
const savedObjectMigrationContext = (null as unknown) as SavedObjectMigrationContext;
|
||||
|
||||
test('should replace index_pattern to index-pattern', () => {
|
||||
const migratedDoc = replaceIndexPatternReference(
|
||||
{
|
||||
references: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'index_pattern',
|
||||
},
|
||||
],
|
||||
} as Parameters<SavedObjectMigrationFn>[0],
|
||||
savedObjectMigrationContext
|
||||
);
|
||||
|
||||
expect(migratedDoc).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"references": Array [
|
||||
Object {
|
||||
"name": "name",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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 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 type { SavedObjectMigrationFn } from 'kibana/server';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../data/common';
|
||||
|
||||
export const replaceIndexPatternReference: SavedObjectMigrationFn<any, any> = (doc) => ({
|
||||
...doc,
|
||||
references: Array.isArray(doc.references)
|
||||
? doc.references.map((reference) => {
|
||||
if (reference.type === 'index_pattern') {
|
||||
reference.type = INDEX_PATTERN_SAVED_OBJECT_TYPE;
|
||||
}
|
||||
return reference;
|
||||
})
|
||||
: doc.references,
|
||||
});
|
|
@ -9,6 +9,9 @@
|
|||
export const DEFAULT_QUERY_LANGUAGE = 'kuery';
|
||||
export const KIBANA_USER_QUERY_LANGUAGE_KEY = 'kibana.userQueryLanguage';
|
||||
|
||||
/** @public **/
|
||||
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = 'index-pattern';
|
||||
|
||||
export const UI_SETTINGS = {
|
||||
META_FIELDS: 'metaFields',
|
||||
DOC_HIGHLIGHT: 'doc_table:highlight',
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import { SavedObjectsClientCommon } from '../..';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE, SavedObjectsClientCommon } from '../..';
|
||||
|
||||
import { createIndexPatternCache } from '.';
|
||||
import type { RuntimeField } from '../types';
|
||||
|
@ -39,7 +39,6 @@ import { DuplicateIndexPatternError } from '../errors';
|
|||
import { castEsToKbnFieldTypeName } from '../../kbn_field_types';
|
||||
|
||||
const MAX_ATTEMPTS_TO_RESOLVE_CONFLICTS = 3;
|
||||
const savedObjectType = 'index-pattern';
|
||||
|
||||
export interface IndexPatternSavedObjectAttrs {
|
||||
title: string;
|
||||
|
@ -98,7 +97,7 @@ export class IndexPatternsService {
|
|||
*/
|
||||
private async refreshSavedObjectsCache() {
|
||||
const so = await this.savedObjectsClient.find<IndexPatternSavedObjectAttrs>({
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
fields: ['title'],
|
||||
perPage: 10000,
|
||||
});
|
||||
|
@ -141,7 +140,7 @@ export class IndexPatternsService {
|
|||
*/
|
||||
find = async (search: string, size: number = 10): Promise<IndexPattern[]> => {
|
||||
const savedObjects = await this.savedObjectsClient.find<IndexPatternSavedObjectAttrs>({
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
fields: ['title'],
|
||||
search,
|
||||
searchFields: ['title'],
|
||||
|
@ -399,12 +398,16 @@ export class IndexPatternsService {
|
|||
|
||||
private getSavedObjectAndInit = async (id: string): Promise<IndexPattern> => {
|
||||
const savedObject = await this.savedObjectsClient.get<IndexPatternAttributes>(
|
||||
savedObjectType,
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id
|
||||
);
|
||||
|
||||
if (!savedObject.version) {
|
||||
throw new SavedObjectNotFound(savedObjectType, id, 'management/kibana/indexPatterns');
|
||||
throw new SavedObjectNotFound(
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id,
|
||||
'management/kibana/indexPatterns'
|
||||
);
|
||||
}
|
||||
|
||||
return this.initFromSavedObject(savedObject);
|
||||
|
@ -487,7 +490,7 @@ export class IndexPatternsService {
|
|||
migrate(indexPattern: IndexPattern, newTitle: string) {
|
||||
return this.savedObjectsClient
|
||||
.update<IndexPatternAttributes>(
|
||||
savedObjectType,
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
indexPattern.id!,
|
||||
{
|
||||
title: newTitle,
|
||||
|
@ -578,7 +581,7 @@ export class IndexPatternsService {
|
|||
|
||||
const body = indexPattern.getAsSavedObjectBody();
|
||||
const response: SavedObject<IndexPatternAttributes> = (await this.savedObjectsClient.create(
|
||||
savedObjectType,
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
body,
|
||||
{
|
||||
id: indexPattern.id,
|
||||
|
@ -619,7 +622,9 @@ export class IndexPatternsService {
|
|||
});
|
||||
|
||||
return this.savedObjectsClient
|
||||
.update(savedObjectType, indexPattern.id, body, { version: indexPattern.version })
|
||||
.update(INDEX_PATTERN_SAVED_OBJECT_TYPE, indexPattern.id, body, {
|
||||
version: indexPattern.version,
|
||||
})
|
||||
.then((resp) => {
|
||||
indexPattern.id = resp.id;
|
||||
indexPattern.version = resp.version;
|
||||
|
@ -687,7 +692,7 @@ export class IndexPatternsService {
|
|||
*/
|
||||
async delete(indexPatternId: string) {
|
||||
this.indexPatternCache.clear(indexPatternId);
|
||||
return this.savedObjectsClient.delete('index-pattern', indexPatternId);
|
||||
return this.savedObjectsClient.delete(INDEX_PATTERN_SAVED_OBJECT_TYPE, indexPatternId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,12 +7,16 @@
|
|||
*/
|
||||
|
||||
import { SavedObjectsClientContract, SimpleSavedObject } from '../../../../../core/public';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../constants';
|
||||
|
||||
export async function getTitle(
|
||||
client: SavedObjectsClientContract,
|
||||
indexPatternId: string
|
||||
): Promise<SimpleSavedObject<any>> {
|
||||
const savedObject = (await client.get('index-pattern', indexPatternId)) as SimpleSavedObject<any>;
|
||||
const savedObject = (await client.get(
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
indexPatternId
|
||||
)) as SimpleSavedObject<any>;
|
||||
|
||||
if (savedObject.error) {
|
||||
throw new Error(`Unable to get index-pattern title: ${savedObject.error.message}`);
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
import type { IndexPatternSavedObjectAttrs } from './index_patterns';
|
||||
import type { SavedObjectsClientCommon } from '../types';
|
||||
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../constants';
|
||||
|
||||
/**
|
||||
* Returns an object matching a given title
|
||||
*
|
||||
|
@ -19,7 +21,7 @@ import type { SavedObjectsClientCommon } from '../types';
|
|||
export async function findByTitle(client: SavedObjectsClientCommon, title: string) {
|
||||
if (title) {
|
||||
const savedObjects = await client.find<IndexPatternSavedObjectAttrs>({
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
perPage: 10,
|
||||
search: `"${title}"`,
|
||||
searchFields: ['title'],
|
||||
|
|
|
@ -10,6 +10,8 @@ import { SavedObjectReference } from 'src/core/types';
|
|||
import { Filter } from '../../es_query/filters';
|
||||
import { SearchSourceFields } from './types';
|
||||
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../constants';
|
||||
|
||||
export const extractReferences = (
|
||||
state: SearchSourceFields
|
||||
): [SearchSourceFields & { indexRefName?: string }, SavedObjectReference[]] => {
|
||||
|
@ -20,7 +22,7 @@ export const extractReferences = (
|
|||
const refName = 'kibanaSavedObjectMeta.searchSourceJSON.index';
|
||||
references.push({
|
||||
name: refName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: indexId,
|
||||
});
|
||||
searchSourceFields = {
|
||||
|
@ -40,7 +42,7 @@ export const extractReferences = (
|
|||
const refName = `kibanaSavedObjectMeta.searchSourceJSON.filter[${i}].meta.index`;
|
||||
references.push({
|
||||
name: refName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: filterRow.meta.index,
|
||||
});
|
||||
return {
|
||||
|
|
|
@ -268,6 +268,7 @@ export {
|
|||
IndexPatternSpec,
|
||||
IndexPatternLoadExpressionFunctionDefinition,
|
||||
fieldList,
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
} from '../common';
|
||||
|
||||
export { DuplicateIndexPatternError } from '../common/index_patterns/errors';
|
||||
|
|
|
@ -1363,6 +1363,9 @@ export interface IKibanaSearchResponse<RawResponse = any> {
|
|||
// @public (undocumented)
|
||||
export type IMetricAggType = MetricAggType;
|
||||
|
||||
// @public (undocumented)
|
||||
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = "index-pattern";
|
||||
|
||||
// Warning: (ae-missing-release-tag) "IndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
@ -2780,20 +2783,20 @@ export interface WaitUntilNextSessionCompletesOptions {
|
|||
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "validateIndexPattern" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "flattenHitWrapper" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:238:27 - (ae-forgotten-export) The symbol "formatHitProvider" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:408:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:408:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:408:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:410:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:411:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:420:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:421:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:422:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:423:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:427:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:428:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:431:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:435:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:409:20 - (ae-forgotten-export) The symbol "getResponseInspectorStats" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:409:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:409:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:411:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:412:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:421:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:422:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:423:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:424:1 - (ae-forgotten-export) The symbol "isDateHistogramBucketAggConfig" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:428:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:429:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:432:1 - (ae-forgotten-export) The symbol "parseInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:433:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/index.ts:436:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/query/state_sync/connect_to_query_state.ts:34:5 - (ae-forgotten-export) The symbol "FilterStateStore" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/public/search/session/session_service.ts:56:5 - (ae-forgotten-export) The symbol "UrlGeneratorStateMapping" needs to be exported by the entry point index.d.ts
|
||||
|
||||
|
|
|
@ -117,7 +117,12 @@ export const fieldFormats = {
|
|||
HistogramFormat,
|
||||
};
|
||||
|
||||
export { IFieldFormatsRegistry, FieldFormatsGetConfigFn, FieldFormatConfig } from '../common';
|
||||
export {
|
||||
IFieldFormatsRegistry,
|
||||
FieldFormatsGetConfigFn,
|
||||
FieldFormatConfig,
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
} from '../common';
|
||||
|
||||
/*
|
||||
* Index patterns:
|
||||
|
|
|
@ -7,7 +7,12 @@
|
|||
*/
|
||||
|
||||
import { SavedObjectsClientContract } from 'kibana/server';
|
||||
import { IFieldType, IndexPatternAttributes, SavedObject } from '../../common';
|
||||
import {
|
||||
IFieldType,
|
||||
INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
IndexPatternAttributes,
|
||||
SavedObject,
|
||||
} from '../../common';
|
||||
|
||||
export const getFieldByName = (
|
||||
fieldName: string,
|
||||
|
@ -24,7 +29,7 @@ export const findIndexPatternById = async (
|
|||
index: string
|
||||
): Promise<SavedObject<IndexPatternAttributes> | undefined> => {
|
||||
const savedObjectsResponse = await savedObjectsClient.find<IndexPatternAttributes>({
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
fields: ['fields'],
|
||||
search: `"${index}"`,
|
||||
searchFields: ['title'],
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { SavedObjectsType } from 'kibana/server';
|
||||
import type { SavedObjectsType } from 'kibana/server';
|
||||
import { indexPatternSavedObjectTypeMigrations } from './index_pattern_migrations';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../common';
|
||||
|
||||
export const indexPatternSavedObjectType: SavedObjectsType = {
|
||||
name: 'index-pattern',
|
||||
name: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
hidden: false,
|
||||
namespaceType: 'single',
|
||||
management: {
|
||||
|
|
|
@ -745,6 +745,9 @@ export interface IFieldType {
|
|||
// @public (undocumented)
|
||||
export type IMetricAggType = MetricAggType;
|
||||
|
||||
// @public (undocumented)
|
||||
export const INDEX_PATTERN_SAVED_OBJECT_TYPE = "index-pattern";
|
||||
|
||||
// Warning: (ae-missing-release-tag) "IndexPattern" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
|
@ -1549,20 +1552,20 @@ export function usageProvider(core: CoreSetup_2): SearchUsage;
|
|||
// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "TruncateFormat" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:101:26 - (ae-forgotten-export) The symbol "HistogramFormat" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:128:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:128:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:245:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:245:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:247:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:248:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:257:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:258:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:259:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:263:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:268:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:271:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:272:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:133:27 - (ae-forgotten-export) The symbol "isFilterable" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:133:27 - (ae-forgotten-export) The symbol "isNestedField" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:250:20 - (ae-forgotten-export) The symbol "tabifyAggResponse" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:250:20 - (ae-forgotten-export) The symbol "tabifyGetColumns" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:252:1 - (ae-forgotten-export) The symbol "CidrMask" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:253:1 - (ae-forgotten-export) The symbol "dateHistogramInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:262:1 - (ae-forgotten-export) The symbol "InvalidEsCalendarIntervalError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:263:1 - (ae-forgotten-export) The symbol "InvalidEsIntervalFormatError" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:264:1 - (ae-forgotten-export) The symbol "IpAddress" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:268:1 - (ae-forgotten-export) The symbol "isValidEsInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:269:1 - (ae-forgotten-export) The symbol "isValidInterval" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:273:1 - (ae-forgotten-export) The symbol "propFilter" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:276:1 - (ae-forgotten-export) The symbol "toAbsoluteDates" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/index.ts:277:1 - (ae-forgotten-export) The symbol "calcAutoIntervalLessThan" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/plugin.ts:81:74 - (ae-forgotten-export) The symbol "DataEnhancements" needs to be exported by the entry point index.d.ts
|
||||
// src/plugins/data/server/search/types.ts:115:5 - (ae-forgotten-export) The symbol "ISearchStartSearchSource" needs to be exported by the entry point index.d.ts
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
import { SavedObjectReference } from '../../../../../core/types';
|
||||
import { VisParams } from '../../../common';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../../data/public';
|
||||
|
||||
const isControlsVis = (visType: string) => visType === 'input_control_vis';
|
||||
|
||||
|
@ -25,7 +26,7 @@ export const extractControlsReferences = (
|
|||
control.indexPatternRefName = `${prefix}_${i}_index_pattern`;
|
||||
references.push({
|
||||
name: control.indexPatternRefName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: control.indexPattern,
|
||||
});
|
||||
delete control.indexPattern;
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
|
||||
import { SavedObjectReference } from '../../../../../core/types';
|
||||
import { VisParams } from '../../../common';
|
||||
import { INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../../data/public';
|
||||
|
||||
/** @internal **/
|
||||
const REF_NAME_POSTFIX = '_ref_name';
|
||||
|
||||
/** @internal **/
|
||||
const INDEX_PATTERN_REF_TYPE = 'index_pattern';
|
||||
|
||||
/** @internal **/
|
||||
type Action = (object: Record<string, any>, key: string) => void;
|
||||
|
||||
|
@ -51,7 +49,7 @@ export const extractTimeSeriesReferences = (
|
|||
object[key + REF_NAME_POSTFIX] = name;
|
||||
references.push({
|
||||
name,
|
||||
type: INDEX_PATTERN_REF_TYPE,
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: object[key].id,
|
||||
});
|
||||
delete object[key];
|
||||
|
|
|
@ -2163,6 +2163,36 @@ describe('migration visualization', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('7.14.0 replaceIndexPatternReference', () => {
|
||||
const migrate = (doc: any) =>
|
||||
visualizationSavedObjectTypeMigrations['7.14.0'](
|
||||
doc as Parameters<SavedObjectMigrationFn>[0],
|
||||
savedObjectMigrationContext
|
||||
);
|
||||
|
||||
test('should replace index_pattern to index-pattern', () => {
|
||||
expect(
|
||||
migrate({
|
||||
references: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'index_pattern',
|
||||
},
|
||||
],
|
||||
} as Parameters<SavedObjectMigrationFn>[0])
|
||||
).toMatchInlineSnapshot(`
|
||||
Object {
|
||||
"references": Array [
|
||||
Object {
|
||||
"name": "name",
|
||||
"type": "index-pattern",
|
||||
},
|
||||
],
|
||||
}
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('7.14.0 update tagcloud defaults', () => {
|
||||
const migrate = (doc: any) =>
|
||||
visualizationSavedObjectTypeMigrations['7.14.0'](
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
import { cloneDeep, get, omit, has, flow, forOwn } from 'lodash';
|
||||
|
||||
import { SavedObjectMigrationFn } from 'kibana/server';
|
||||
import type { SavedObjectMigrationFn } from 'kibana/server';
|
||||
|
||||
import { DEFAULT_QUERY_LANGUAGE } from '../../../data/common';
|
||||
import { DEFAULT_QUERY_LANGUAGE, INDEX_PATTERN_SAVED_OBJECT_TYPE } from '../../../data/common';
|
||||
import {
|
||||
commonAddSupportOfDualIndexSelectionModeInTSVB,
|
||||
commonHideTSVBLastValueIndicator,
|
||||
|
@ -37,7 +37,7 @@ const migrateIndexPattern: SavedObjectMigrationFn<any, any> = (doc) => {
|
|||
searchSource.indexRefName = 'kibanaSavedObjectMeta.searchSourceJSON.index';
|
||||
doc.references.push({
|
||||
name: searchSource.indexRefName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: searchSource.index,
|
||||
});
|
||||
delete searchSource.index;
|
||||
|
@ -50,7 +50,7 @@ const migrateIndexPattern: SavedObjectMigrationFn<any, any> = (doc) => {
|
|||
filterRow.meta.indexRefName = `kibanaSavedObjectMeta.searchSourceJSON.filter[${i}].meta.index`;
|
||||
doc.references.push({
|
||||
name: filterRow.meta.indexRefName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: filterRow.meta.index,
|
||||
});
|
||||
delete filterRow.meta.index;
|
||||
|
@ -648,7 +648,7 @@ const migrateControls: SavedObjectMigrationFn<any, any> = (doc) => {
|
|||
control.indexPatternRefName = `control_${i}_index_pattern`;
|
||||
doc.references.push({
|
||||
name: control.indexPatternRefName,
|
||||
type: 'index-pattern',
|
||||
type: INDEX_PATTERN_SAVED_OBJECT_TYPE,
|
||||
id: control.indexPattern,
|
||||
});
|
||||
delete control.indexPattern;
|
||||
|
@ -1038,6 +1038,18 @@ const migrateTagCloud: SavedObjectMigrationFn<any, any> = (doc) => {
|
|||
return doc;
|
||||
};
|
||||
|
||||
export const replaceIndexPatternReference: SavedObjectMigrationFn<any, any> = (doc) => ({
|
||||
...doc,
|
||||
references: Array.isArray(doc.references)
|
||||
? doc.references.map((reference) => {
|
||||
if (reference.type === 'index_pattern') {
|
||||
reference.type = INDEX_PATTERN_SAVED_OBJECT_TYPE;
|
||||
}
|
||||
return reference;
|
||||
})
|
||||
: doc.references,
|
||||
});
|
||||
|
||||
export const visualizationSavedObjectTypeMigrations = {
|
||||
/**
|
||||
* We need to have this migration twice, once with a version prior to 7.0.0 once with a version
|
||||
|
@ -1084,5 +1096,10 @@ export const visualizationSavedObjectTypeMigrations = {
|
|||
hideTSVBLastValueIndicator,
|
||||
removeDefaultIndexPatternAndTimeFieldFromTSVBModel
|
||||
),
|
||||
'7.14.0': flow(addEmptyValueColorRule, migrateVislibPie, migrateTagCloud),
|
||||
'7.14.0': flow(
|
||||
addEmptyValueColorRule,
|
||||
migrateVislibPie,
|
||||
migrateTagCloud,
|
||||
replaceIndexPatternReference
|
||||
),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue