mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
[feature branch] index pattern => data view for user facing content (#109821)
* [index pattern management] index pattern => data view for user facing content (#109577)
This commit is contained in:
parent
ee3c0c447e
commit
64f1dddcb0
249 changed files with 881 additions and 1307 deletions
|
@ -62,16 +62,16 @@ export function getActions(
|
|||
});
|
||||
}
|
||||
|
||||
// Allow to edit index pattern field
|
||||
// Allow to edit data view field
|
||||
if (services.indexPatternFieldEditor?.userPermissions.editIndexPattern()) {
|
||||
actions.push({
|
||||
name: i18n.translate('xpack.dataVisualizer.index.dataGrid.editIndexPatternFieldTitle', {
|
||||
defaultMessage: 'Edit index pattern field',
|
||||
name: i18n.translate('xpack.dataVisualizer.index.dataGrid.editDataViewFieldTitle', {
|
||||
defaultMessage: 'Edit data view field',
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.dataVisualizer.index.dataGrid.editIndexPatternFieldDescription',
|
||||
'xpack.dataVisualizer.index.dataGrid.editDataViewFieldDescription',
|
||||
{
|
||||
defaultMessage: 'Edit index pattern field',
|
||||
defaultMessage: 'Edit data view field',
|
||||
}
|
||||
),
|
||||
type: 'icon',
|
||||
|
@ -86,13 +86,13 @@ export function getActions(
|
|||
'data-test-subj': 'dataVisualizerActionEditIndexPatternFieldButton',
|
||||
});
|
||||
actions.push({
|
||||
name: i18n.translate('xpack.dataVisualizer.index.dataGrid.deleteIndexPatternFieldTitle', {
|
||||
defaultMessage: 'Delete index pattern field',
|
||||
name: i18n.translate('xpack.dataVisualizer.index.dataGrid.deleteDataViewFieldTitle', {
|
||||
defaultMessage: 'Delete data view field',
|
||||
}),
|
||||
description: i18n.translate(
|
||||
'xpack.dataVisualizer.index.dataGrid.deleteIndexPatternFieldDescription',
|
||||
{
|
||||
defaultMessage: 'Delete index pattern field',
|
||||
defaultMessage: 'Delete data view field',
|
||||
}
|
||||
),
|
||||
type: 'icon',
|
||||
|
|
|
@ -32,7 +32,7 @@ const defaultIcon = { iconType: 'questionInCircle', color: 'gray' };
|
|||
// Extended & modified version of src/plugins/kibana_react/public/field_icon/field_icon.tsx
|
||||
export const typeToEuiIconMap: Record<string, { iconType: string; color?: string }> = {
|
||||
boolean: { iconType: 'tokenBoolean' },
|
||||
// icon for an index pattern mapping conflict in discover
|
||||
// icon for a data view mapping conflict in discover
|
||||
conflict: { iconType: 'alert', color: 'euiColorVis9' },
|
||||
date: { iconType: 'tokenDate' },
|
||||
date_range: { iconType: 'tokenDate' },
|
||||
|
|
|
@ -241,8 +241,8 @@ export const ResultsLinks: FC<Props> = ({
|
|||
icon={<EuiIcon size="xxl" type={`managementApp`} />}
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.resultsLinks.indexPatternManagementTitle"
|
||||
defaultMessage="Index Pattern Management"
|
||||
id="xpack.dataVisualizer.file.resultsLinks.dataViewManagementTitle"
|
||||
defaultMessage="Data View Management"
|
||||
/>
|
||||
}
|
||||
description=""
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Formatter which uses the fieldFormat object of a Kibana index pattern
|
||||
* Formatter which uses the fieldFormat object of a Kibana data view
|
||||
* field to format the value of a field.
|
||||
*/
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ function title(statuses: Statuses) {
|
|||
case statuses.indexPatternCreatedStatus:
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.importErrors.creatingIndexPatternErrorMessage"
|
||||
defaultMessage="Error creating index pattern"
|
||||
id="xpack.dataVisualizer.file.importErrors.creatingDataViewErrorMessage"
|
||||
defaultMessage="Error creating data view"
|
||||
/>
|
||||
);
|
||||
case statuses.permissionCheckStatus:
|
||||
|
|
|
@ -103,10 +103,10 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => {
|
|||
defaultMessage: 'Upload data',
|
||||
}
|
||||
);
|
||||
let createIndexPatternTitle = i18n.translate(
|
||||
'xpack.dataVisualizer.file.importProgress.createIndexPatternTitle',
|
||||
let createDataViewTitle = i18n.translate(
|
||||
'xpack.dataVisualizer.file.importProgress.createDataViewTitle',
|
||||
{
|
||||
defaultMessage: 'Create index pattern',
|
||||
defaultMessage: 'Create data view',
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -199,17 +199,17 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => {
|
|||
}
|
||||
);
|
||||
if (createIndexPattern === true) {
|
||||
createIndexPatternTitle = i18n.translate(
|
||||
'xpack.dataVisualizer.file.importProgress.creatingIndexPatternTitle',
|
||||
createDataViewTitle = i18n.translate(
|
||||
'xpack.dataVisualizer.file.importProgress.creatingDataViewTitle',
|
||||
{
|
||||
defaultMessage: 'Creating index pattern',
|
||||
defaultMessage: 'Creating data view',
|
||||
}
|
||||
);
|
||||
statusInfo = (
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.importProgress.creatingIndexPatternDescription"
|
||||
defaultMessage="Creating index pattern"
|
||||
id="xpack.dataVisualizer.file.importProgress.creatingDataViewDescription"
|
||||
defaultMessage="Creating data view"
|
||||
/>
|
||||
</p>
|
||||
);
|
||||
|
@ -218,10 +218,10 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => {
|
|||
}
|
||||
}
|
||||
if (completedStep >= 5) {
|
||||
createIndexPatternTitle = i18n.translate(
|
||||
'xpack.dataVisualizer.file.importProgress.indexPatternCreatedTitle',
|
||||
createDataViewTitle = i18n.translate(
|
||||
'xpack.dataVisualizer.file.importProgress.dataViewCreatedTitle',
|
||||
{
|
||||
defaultMessage: 'Index pattern created',
|
||||
defaultMessage: 'Data view created',
|
||||
}
|
||||
);
|
||||
statusInfo = null;
|
||||
|
@ -267,7 +267,7 @@ export const ImportProgress: FC<{ statuses: Statuses }> = ({ statuses }) => {
|
|||
|
||||
if (createIndexPattern === true) {
|
||||
steps.push({
|
||||
title: createIndexPatternTitle,
|
||||
title: createDataViewTitle,
|
||||
isSelected: uploadStatus === IMPORT_STATUS.COMPLETE,
|
||||
isComplete: indexPatternCreatedStatus === IMPORT_STATUS.COMPLETE,
|
||||
status: indexPatternCreatedStatus,
|
||||
|
|
|
@ -102,8 +102,8 @@ export const AdvancedSettings: FC<Props> = ({
|
|||
id="createIndexPattern"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.advancedImportSettings.createIndexPatternLabel"
|
||||
defaultMessage="Create index pattern"
|
||||
id="xpack.dataVisualizer.file.advancedImportSettings.createDataViewLabel"
|
||||
defaultMessage="Create data view"
|
||||
/>
|
||||
}
|
||||
checked={createIndexPattern === true}
|
||||
|
@ -116,8 +116,8 @@ export const AdvancedSettings: FC<Props> = ({
|
|||
<EuiFormRow
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.advancedImportSettings.indexPatternNameLabel"
|
||||
defaultMessage="Index pattern name"
|
||||
id="xpack.dataVisualizer.file.advancedImportSettings.dataViewNameLabel"
|
||||
defaultMessage="Data view name"
|
||||
/>
|
||||
}
|
||||
isInvalid={indexPatternNameError !== ''}
|
||||
|
|
|
@ -73,8 +73,8 @@ export const SimpleSettings: FC<Props> = ({
|
|||
id="createIndexPattern"
|
||||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.simpleImportSettings.createIndexPatternLabel"
|
||||
defaultMessage="Create index pattern"
|
||||
id="xpack.dataVisualizer.file.simpleImportSettings.createDataViewLabel"
|
||||
defaultMessage="Create data view"
|
||||
/>
|
||||
}
|
||||
checked={createIndexPattern === true}
|
||||
|
|
|
@ -135,8 +135,8 @@ function createDisplayItems(
|
|||
items.splice(1, 0, {
|
||||
title: (
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.importSummary.indexPatternTitle"
|
||||
defaultMessage="Index pattern"
|
||||
id="xpack.dataVisualizer.file.importSummary.dataViewTitle"
|
||||
defaultMessage="Data view"
|
||||
/>
|
||||
),
|
||||
description: indexPattern,
|
||||
|
|
|
@ -433,7 +433,7 @@ export class ImportView extends Component {
|
|||
|
||||
this.setState({ indexPatternNames });
|
||||
} catch (error) {
|
||||
console.error('failed to load index patterns', error);
|
||||
console.error('failed to load data views', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -704,8 +704,8 @@ function isIndexPatternNameValid(name, indexPatternNames, index) {
|
|||
if (indexPatternNames.find((i) => i === name)) {
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.importView.indexPatternNameAlreadyExistsErrorMessage"
|
||||
defaultMessage="Index pattern name already exists"
|
||||
id="xpack.dataVisualizer.file.importView.dataViewNameAlreadyExistsErrorMessage"
|
||||
defaultMessage="Data view name already exists"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -720,8 +720,8 @@ function isIndexPatternNameValid(name, indexPatternNames, index) {
|
|||
// name should match index
|
||||
return (
|
||||
<FormattedMessage
|
||||
id="xpack.dataVisualizer.file.importView.indexPatternDoesNotMatchIndexNameErrorMessage"
|
||||
defaultMessage="Index pattern does not match index name"
|
||||
id="xpack.dataVisualizer.file.importView.indexPatternDoesNotMatchDataViewErrorMessage"
|
||||
defaultMessage="Data view does not match index name"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ interface Props {
|
|||
}
|
||||
|
||||
// Component for rendering a button which automatically sets the range of the time filter
|
||||
// to the time range of data in the index(es) mapped to the supplied Kibana index pattern or query.
|
||||
// to the time range of data in the index(es) mapped to the supplied Kibana data view or query.
|
||||
export const FullTimeRangeSelector: FC<Props> = ({
|
||||
timefilter,
|
||||
indexPattern,
|
||||
|
|
|
@ -157,7 +157,7 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
|
|||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
// When navigating away from the index pattern
|
||||
// When navigating away from the data view
|
||||
// Reset all previously set filters
|
||||
// to make sure new page doesn't have unrelated filters
|
||||
data.query.filterManager.removeAll();
|
||||
|
@ -206,10 +206,10 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
|
|||
if (!currentIndexPattern.isTimeBased()) {
|
||||
toasts.addWarning({
|
||||
title: i18n.translate(
|
||||
'xpack.dataVisualizer.index.indexPatternNotBasedOnTimeSeriesNotificationTitle',
|
||||
'xpack.dataVisualizer.index.dataViewNotBasedOnTimeSeriesNotificationTitle',
|
||||
{
|
||||
defaultMessage: 'The index pattern {indexPatternTitle} is not based on a time series',
|
||||
values: { indexPatternTitle: currentIndexPattern.title },
|
||||
defaultMessage: 'The data view {dataViewTitle} is not based on a time series',
|
||||
values: { dataViewTitle: currentIndexPattern.title },
|
||||
}
|
||||
),
|
||||
text: i18n.translate(
|
||||
|
@ -225,7 +225,7 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
|
|||
const indexPatternFields: IndexPatternField[] = currentIndexPattern.fields;
|
||||
|
||||
const fieldTypes = useMemo(() => {
|
||||
// Obtain the list of non metric field types which appear in the index pattern.
|
||||
// Obtain the list of non metric field types which appear in the data view.
|
||||
const indexedFieldTypes: JobFieldType[] = [];
|
||||
indexPatternFields.forEach((field) => {
|
||||
if (!OMIT_FIELDS.includes(field.name) && field.scripted !== true) {
|
||||
|
@ -275,7 +275,7 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
|
|||
filters: Filter[];
|
||||
}) => {
|
||||
// When the user loads saved search and then clear or modify the query
|
||||
// we should remove the saved search and replace it with the index pattern id
|
||||
// we should remove the saved search and replace it with the data view id
|
||||
if (currentSavedSearch !== null) {
|
||||
setCurrentSavedSearch(null);
|
||||
}
|
||||
|
@ -689,7 +689,7 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
|
|||
});
|
||||
// Obtain the list of all non-metric fields which appear in documents
|
||||
// (aggregatable or not aggregatable).
|
||||
const populatedNonMetricFields: any[] = []; // Kibana index pattern non metric fields.
|
||||
const populatedNonMetricFields: any[] = []; // Kibana data view non metric fields.
|
||||
let nonMetricFieldData: any[] = []; // Basic non metric field data loaded from requesting overall stats.
|
||||
const aggregatableExistsFields: any[] = overallStats.aggregatableExistsFields || [];
|
||||
const nonAggregatableExistsFields: any[] = overallStats.nonAggregatableExistsFields || [];
|
||||
|
@ -743,7 +743,7 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
|
|||
deletable: field.runtimeField !== undefined,
|
||||
};
|
||||
|
||||
// Map the field type from the Kibana index pattern to the field type
|
||||
// Map the field type from the Kibana data view to the field type
|
||||
// used in the data visualizer.
|
||||
const dataVisualizerType = kbnTypeToJobType(field);
|
||||
if (dataVisualizerType !== undefined) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { dataVisualizerRefresh$, Refresh } from '../../services/timefilter_refre
|
|||
|
||||
export interface DataVisualizerIndexPatternManagementProps {
|
||||
/**
|
||||
* Currently selected index pattern
|
||||
* Currently selected data view
|
||||
*/
|
||||
currentIndexPattern?: IndexPattern;
|
||||
/**
|
||||
|
@ -79,9 +79,9 @@ export function DataVisualizerIndexPatternManagement(
|
|||
iconType="boxesHorizontal"
|
||||
data-test-subj="dataVisualizerIndexPatternManagementButton"
|
||||
aria-label={i18n.translate(
|
||||
'xpack.dataVisualizer.index.indexPatternManagement.actionsPopoverLabel',
|
||||
'xpack.dataVisualizer.index.dataViewManagement.actionsPopoverLabel',
|
||||
{
|
||||
defaultMessage: 'Index pattern settings',
|
||||
defaultMessage: 'Data view settings',
|
||||
}
|
||||
)}
|
||||
onClick={() => {
|
||||
|
@ -103,8 +103,8 @@ export function DataVisualizerIndexPatternManagement(
|
|||
addField();
|
||||
}}
|
||||
>
|
||||
{i18n.translate('xpack.dataVisualizer.index.indexPatternManagement.addFieldButton', {
|
||||
defaultMessage: 'Add field to index pattern',
|
||||
{i18n.translate('xpack.dataVisualizer.index.dataViewManagement.addFieldButton', {
|
||||
defaultMessage: 'Add field to data view',
|
||||
})}
|
||||
</EuiContextMenuItem>,
|
||||
<EuiContextMenuItem
|
||||
|
@ -118,8 +118,8 @@ export function DataVisualizerIndexPatternManagement(
|
|||
});
|
||||
}}
|
||||
>
|
||||
{i18n.translate('xpack.dataVisualizer.index.indexPatternManagement.manageFieldButton', {
|
||||
defaultMessage: 'Manage index pattern fields',
|
||||
{i18n.translate('xpack.dataVisualizer.index.dataViewManagement.manageFieldButton', {
|
||||
defaultMessage: 'Manage data view fields',
|
||||
})}
|
||||
</EuiContextMenuItem>,
|
||||
]}
|
||||
|
|
|
@ -77,8 +77,8 @@ export const DataVisualizerUrlStateContextProvider: FC<DataVisualizerUrlStateCon
|
|||
setCurrentIndexPattern(indexPattern);
|
||||
} catch (e) {
|
||||
toasts.addError(e, {
|
||||
title: i18n.translate('xpack.dataVisualizer.index.indexPatternErrorMessage', {
|
||||
defaultMessage: 'Error finding index pattern',
|
||||
title: i18n.translate('xpack.dataVisualizer.index.dataViewErrorMessage', {
|
||||
defaultMessage: 'Error finding data view',
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ describe('Index data visualizer locator', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('should prioritize savedSearchId even when index pattern id is available', async () => {
|
||||
it('should prioritize savedSearchId even when data view id is available', async () => {
|
||||
const location = await definition.getLocation({
|
||||
indexPatternId: '3da93760-e0af-11ea-9ad3-3bcfc330e42a',
|
||||
savedSearchId: '45014020-dffa-11eb-b120-a105fbbe93b3',
|
||||
|
|
|
@ -18,7 +18,7 @@ import { IndexPattern } from '../../../../../../../src/plugins/data/common';
|
|||
import { fieldFormatsMock } from '../../../../../../../src/plugins/field_formats/common/mocks';
|
||||
import { uiSettingsServiceMock } from 'src/core/public/mocks';
|
||||
|
||||
// helper function to create index patterns
|
||||
// helper function to create data views
|
||||
function createMockDataView(id: string) {
|
||||
const {
|
||||
type,
|
||||
|
|
|
@ -41,7 +41,7 @@ export const checkAggregatableFieldsExist = async (
|
|||
// filter aggregation with exists query.
|
||||
const aggs: Aggs = datafeedAggregations !== undefined ? { ...datafeedAggregations } : {};
|
||||
|
||||
// Combine runtime fields from the index pattern as well as the datafeed
|
||||
// Combine runtime fields from the data view as well as the datafeed
|
||||
const combinedRuntimeMappings: estypes.MappingRuntimeFields = {
|
||||
...(isPopulatedObject(runtimeMappings) ? runtimeMappings : {}),
|
||||
...(isPopulatedObject(datafeedConfig) && isPopulatedObject(datafeedConfig.runtime_mappings)
|
||||
|
|
|
@ -40,7 +40,7 @@ export class DataVisualizer {
|
|||
this._client = client;
|
||||
}
|
||||
|
||||
// Obtains overall stats on the fields in the supplied index pattern, returning an object
|
||||
// Obtains overall stats on the fields in the supplied data view, returning an object
|
||||
// containing the total document count, and four arrays showing which of the supplied
|
||||
// aggregatable and non-aggregatable fields do or do not exist in documents.
|
||||
// Sampling will be used if supplied samplerShardSize > 0.
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
dataVisualizerFieldHistogramsSchema,
|
||||
dataVisualizerFieldStatsSchema,
|
||||
dataVisualizerOverallStatsSchema,
|
||||
indexPatternTitleSchema,
|
||||
dataViewTitleSchema,
|
||||
} from './schemas';
|
||||
import type { Field, StartDeps, HistogramField } from '../types';
|
||||
import { DataVisualizer } from '../models/data_visualizer';
|
||||
|
@ -97,33 +97,33 @@ export function dataVisualizerRoutes(coreSetup: CoreSetup<StartDeps, unknown>) {
|
|||
/**
|
||||
* @apiGroup DataVisualizer
|
||||
*
|
||||
* @api {post} /internal/data_visualizer/get_field_histograms/:indexPatternTitle Get histograms for fields
|
||||
* @api {post} /internal/data_visualizer/get_field_histograms/:dataViewTitle Get histograms for fields
|
||||
* @apiName GetHistogramsForFields
|
||||
* @apiDescription Returns the histograms on a list fields in the specified index pattern.
|
||||
* @apiDescription Returns the histograms on a list fields in the specified data view.
|
||||
*
|
||||
* @apiSchema (params) indexPatternTitleSchema
|
||||
* @apiSchema (params) dataViewTitleSchema
|
||||
* @apiSchema (body) dataVisualizerFieldHistogramsSchema
|
||||
*
|
||||
* @apiSuccess {Object} fieldName histograms by field, keyed on the name of the field.
|
||||
*/
|
||||
router.post(
|
||||
{
|
||||
path: '/internal/data_visualizer/get_field_histograms/{indexPatternTitle}',
|
||||
path: '/internal/data_visualizer/get_field_histograms/{dataViewTitle}',
|
||||
validate: {
|
||||
params: indexPatternTitleSchema,
|
||||
params: dataViewTitleSchema,
|
||||
body: dataVisualizerFieldHistogramsSchema,
|
||||
},
|
||||
},
|
||||
async (context, request, response) => {
|
||||
try {
|
||||
const {
|
||||
params: { indexPatternTitle },
|
||||
params: { dataViewTitle },
|
||||
body: { query, fields, samplerShardSize, runtimeMappings },
|
||||
} = request;
|
||||
|
||||
const results = await getHistogramsForFields(
|
||||
context.core.elasticsearch.client,
|
||||
indexPatternTitle,
|
||||
dataViewTitle,
|
||||
query,
|
||||
fields,
|
||||
samplerShardSize,
|
||||
|
@ -142,27 +142,27 @@ export function dataVisualizerRoutes(coreSetup: CoreSetup<StartDeps, unknown>) {
|
|||
/**
|
||||
* @apiGroup DataVisualizer
|
||||
*
|
||||
* @api {post} /internal/data_visualizer/get_field_stats/:indexPatternTitle Get stats for fields
|
||||
* @api {post} /internal/data_visualizer/get_field_stats/:dataViewTitle Get stats for fields
|
||||
* @apiName GetStatsForFields
|
||||
* @apiDescription Returns the stats on individual fields in the specified index pattern.
|
||||
* @apiDescription Returns the stats on individual fields in the specified data view.
|
||||
*
|
||||
* @apiSchema (params) indexPatternTitleSchema
|
||||
* @apiSchema (params) dataViewTitleSchema
|
||||
* @apiSchema (body) dataVisualizerFieldStatsSchema
|
||||
*
|
||||
* @apiSuccess {Object} fieldName stats by field, keyed on the name of the field.
|
||||
*/
|
||||
router.post(
|
||||
{
|
||||
path: '/internal/data_visualizer/get_field_stats/{indexPatternTitle}',
|
||||
path: '/internal/data_visualizer/get_field_stats/{dataViewTitle}',
|
||||
validate: {
|
||||
params: indexPatternTitleSchema,
|
||||
params: dataViewTitleSchema,
|
||||
body: dataVisualizerFieldStatsSchema,
|
||||
},
|
||||
},
|
||||
async (context, request, response) => {
|
||||
try {
|
||||
const {
|
||||
params: { indexPatternTitle },
|
||||
params: { dataViewTitle },
|
||||
body: {
|
||||
query,
|
||||
fields,
|
||||
|
@ -177,7 +177,7 @@ export function dataVisualizerRoutes(coreSetup: CoreSetup<StartDeps, unknown>) {
|
|||
} = request;
|
||||
const results = await getStatsForFields(
|
||||
context.core.elasticsearch.client,
|
||||
indexPatternTitle,
|
||||
dataViewTitle,
|
||||
query,
|
||||
fields,
|
||||
samplerShardSize,
|
||||
|
@ -201,11 +201,11 @@ export function dataVisualizerRoutes(coreSetup: CoreSetup<StartDeps, unknown>) {
|
|||
/**
|
||||
* @apiGroup DataVisualizer
|
||||
*
|
||||
* @api {post} /internal/data_visualizer/get_overall_stats/:indexPatternTitle Get overall stats
|
||||
* @api {post} /internal/data_visualizer/get_overall_stats/:dataViewTitle Get overall stats
|
||||
* @apiName GetOverallStats
|
||||
* @apiDescription Returns the top level overall stats for the specified index pattern.
|
||||
* @apiDescription Returns the top level overall stats for the specified data view.
|
||||
*
|
||||
* @apiSchema (params) indexPatternTitleSchema
|
||||
* @apiSchema (params) dataViewTitleSchema
|
||||
* @apiSchema (body) dataVisualizerOverallStatsSchema
|
||||
*
|
||||
* @apiSuccess {number} totalCount total count of documents.
|
||||
|
@ -216,16 +216,16 @@ export function dataVisualizerRoutes(coreSetup: CoreSetup<StartDeps, unknown>) {
|
|||
*/
|
||||
router.post(
|
||||
{
|
||||
path: '/internal/data_visualizer/get_overall_stats/{indexPatternTitle}',
|
||||
path: '/internal/data_visualizer/get_overall_stats/{dataViewTitle}',
|
||||
validate: {
|
||||
params: indexPatternTitleSchema,
|
||||
params: dataViewTitleSchema,
|
||||
body: dataVisualizerOverallStatsSchema,
|
||||
},
|
||||
},
|
||||
async (context, request, response) => {
|
||||
try {
|
||||
const {
|
||||
params: { indexPatternTitle },
|
||||
params: { dataViewTitle },
|
||||
body: {
|
||||
query,
|
||||
aggregatableFields,
|
||||
|
@ -240,7 +240,7 @@ export function dataVisualizerRoutes(coreSetup: CoreSetup<StartDeps, unknown>) {
|
|||
|
||||
const results = await getOverallStats(
|
||||
context.core.elasticsearch.client,
|
||||
indexPatternTitle,
|
||||
dataViewTitle,
|
||||
query,
|
||||
aggregatableFields,
|
||||
nonAggregatableFields,
|
||||
|
|
|
@ -20,9 +20,9 @@ export const runtimeMappingsSchema = schema.object(
|
|||
}
|
||||
);
|
||||
|
||||
export const indexPatternTitleSchema = schema.object({
|
||||
/** Title of the index pattern for which to return stats. */
|
||||
indexPatternTitle: schema.string(),
|
||||
export const dataViewTitleSchema = schema.object({
|
||||
/** Title of the data view for which to return stats. */
|
||||
dataViewTitle: schema.string(),
|
||||
});
|
||||
|
||||
export const dataVisualizerFieldHistogramsSchema = schema.object({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue