kibana/x-pack/plugins/lens/server/saved_objects.ts
Tim Roes ade93f0780
Disable indexing of unnecessary Saved Object fields (#70409)
* Disable indexing of unnecessary SO fields

* Add doc_values

* Add no doc_values to discover saved object

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-07-20 11:40:39 +02:00

72 lines
1.6 KiB
TypeScript

/*
* 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 { CoreSetup } from 'kibana/server';
import { getEditPath } from '../common';
import { migrations } from './migrations';
export function setupSavedObjects(core: CoreSetup) {
core.savedObjects.registerType({
name: 'lens',
hidden: false,
namespaceType: 'single',
management: {
icon: 'lensApp',
defaultSearchField: 'title',
importableAndExportable: true,
getTitle: (obj: { attributes: { title: string } }) => obj.attributes.title,
getInAppUrl: (obj: { id: string }) => ({
path: `/app/lens${getEditPath(obj.id)}`,
uiCapabilitiesPath: 'visualize.show',
}),
},
migrations,
mappings: {
properties: {
title: {
type: 'text',
},
description: {
type: 'text',
},
visualizationType: {
type: 'keyword',
},
state: {
type: 'flattened',
},
expression: {
index: false,
doc_values: false,
type: 'keyword',
},
},
},
});
core.savedObjects.registerType({
name: 'lens-ui-telemetry',
hidden: false,
namespaceType: 'single',
mappings: {
properties: {
name: {
type: 'keyword',
},
type: {
type: 'keyword',
},
date: {
type: 'date',
},
count: {
type: 'integer',
},
},
},
});
}