From 828e76840f6400d5d4354ad33ba75f5a09f0fa9c Mon Sep 17 00:00:00 2001 From: Tim Roes Date: Mon, 27 Jan 2020 18:52:01 +0100 Subject: [PATCH] Hide nested fields across Kibana apps (#55278) (#56030) * Hide nested fields across Kibana apps * Filter out nested fields in TSVB * Fix import paths * Hide nested fields in timelion autocomplete * Fix remaining map places * Filter out nested fields in graph * Fix remaining map places Co-authored-by: Elastic Machine Co-authored-by: Elastic Machine --- .../timelion/public/services/arg_value_suggestions.ts | 11 ++++++++--- .../vis_type_timeseries/server/lib/get_fields.js | 3 ++- src/legacy/ui/public/agg_types/param_types/field.ts | 3 ++- .../data/common/index_patterns/fields/index.ts | 2 +- .../data/common/index_patterns/fields/utils.ts | 4 ++++ src/plugins/data/public/index.ts | 1 + src/plugins/data/server/index.ts | 1 + .../graph/public/services/persistence/deserialize.ts | 4 ++-- .../plugins/lens/public/indexpattern_plugin/loader.ts | 7 ++++--- .../maps/public/connected_components/gis_map/view.js | 6 ++++-- .../layer_panel/join_editor/resources/join.js | 3 ++- .../join_editor/resources/join_expression.js | 3 ++- .../legacy/plugins/maps/public/index_pattern_util.js | 9 +++++++-- .../plugins/maps/public/layers/fields/es_doc_field.js | 4 +++- .../es_geo_grid_source/create_source_editor.js | 11 +++++++++-- .../es_geo_grid_source/update_source_editor.js | 3 ++- .../sources/es_pew_pew_source/create_source_editor.js | 11 +++++++++-- .../sources/es_pew_pew_source/es_pew_pew_source.js | 4 +++- .../sources/es_pew_pew_source/update_source_editor.js | 3 ++- .../sources/es_search_source/create_source_editor.js | 11 +++++++++-- .../sources/es_search_source/update_source_editor.js | 3 ++- 21 files changed, 79 insertions(+), 28 deletions(-) diff --git a/src/legacy/core_plugins/timelion/public/services/arg_value_suggestions.ts b/src/legacy/core_plugins/timelion/public/services/arg_value_suggestions.ts index 8d133de51f6d9a..5b0362bf6f4807 100644 --- a/src/legacy/core_plugins/timelion/public/services/arg_value_suggestions.ts +++ b/src/legacy/core_plugins/timelion/public/services/arg_value_suggestions.ts @@ -20,6 +20,7 @@ import { get } from 'lodash'; import { TimelionFunctionArgs } from '../../common/types'; import { getIndexPatterns, getSavedObjectsClient } from './plugin_services'; +import { isNestedField } from '../../../../../../src/plugins/data/public'; export interface Location { min: number; @@ -120,7 +121,8 @@ export function getArgValueSuggestions() { return ( field.aggregatable && 'number' === field.type && - containsFieldName(valueSplit[1], field) + containsFieldName(valueSplit[1], field) && + !isNestedField(field) ); }) .map(field => { @@ -138,7 +140,8 @@ export function getArgValueSuggestions() { return ( field.aggregatable && ['number', 'boolean', 'date', 'ip', 'string'].includes(field.type) && - containsFieldName(partial, field) + containsFieldName(partial, field) && + !isNestedField(field) ); }) .map(field => { @@ -153,7 +156,9 @@ export function getArgValueSuggestions() { return indexPattern.fields .filter(field => { - return 'date' === field.type && containsFieldName(partial, field); + return ( + 'date' === field.type && containsFieldName(partial, field) && !isNestedField(field) + ); }) .map(field => { return { name: field.name }; diff --git a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js b/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js index c16452ab4b8952..361ce132f17359 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js +++ b/src/legacy/core_plugins/vis_type_timeseries/server/lib/get_fields.js @@ -19,6 +19,7 @@ import { SearchStrategiesRegister } from './search_strategies/search_strategies_register'; import { uniq } from 'lodash'; import { getIndexPatternObject } from './vis_data/helpers/get_index_pattern'; +import { isNestedField } from '../../../../../plugins/data/server'; export async function getFields(req) { const indexPattern = req.query.index; @@ -30,7 +31,7 @@ export async function getFields(req) { const fields = ( await searchStrategy.getFieldsForWildcard(req, indexPatternString, capabilities) - ).filter(field => field.aggregatable); + ).filter(field => field.aggregatable && !isNestedField(field)); return uniq(fields, field => field.name); } diff --git a/src/legacy/ui/public/agg_types/param_types/field.ts b/src/legacy/ui/public/agg_types/param_types/field.ts index a0fa6ad6e3189b..090ea14bb64a94 100644 --- a/src/legacy/ui/public/agg_types/param_types/field.ts +++ b/src/legacy/ui/public/agg_types/param_types/field.ts @@ -26,6 +26,7 @@ import { BaseParamType } from './base'; import { toastNotifications } from '../../notify'; import { propFilter } from '../filter'; import { Field, IFieldList } from '../../../../../plugins/data/public'; +import { isNestedField } from '../../../../../plugins/data/public'; const filterByType = propFilter('type'); @@ -116,7 +117,7 @@ export class FieldParamType extends BaseParamType { const { onlyAggregatable, scriptable, filterFieldTypes } = this; if ( - (onlyAggregatable && (!field.aggregatable || field.subType?.nested)) || + (onlyAggregatable && (!field.aggregatable || isNestedField(field))) || (!scriptable && field.scripted) ) { return false; diff --git a/src/plugins/data/common/index_patterns/fields/index.ts b/src/plugins/data/common/index_patterns/fields/index.ts index 2b43dffa8c161e..5b6fef3e51fa9b 100644 --- a/src/plugins/data/common/index_patterns/fields/index.ts +++ b/src/plugins/data/common/index_patterns/fields/index.ts @@ -18,4 +18,4 @@ */ export * from './types'; -export { isFilterable } from './utils'; +export { isFilterable, isNestedField } from './utils'; diff --git a/src/plugins/data/common/index_patterns/fields/utils.ts b/src/plugins/data/common/index_patterns/fields/utils.ts index c7bec5e5ad3476..e587c0fe632f11 100644 --- a/src/plugins/data/common/index_patterns/fields/utils.ts +++ b/src/plugins/data/common/index_patterns/fields/utils.ts @@ -28,3 +28,7 @@ export function isFilterable(field: IFieldType): boolean { Boolean(field.searchable && filterableTypes.includes(field.type)) ); } + +export function isNestedField(field: IFieldType): boolean { + return !!field.subType?.nested; +} diff --git a/src/plugins/data/public/index.ts b/src/plugins/data/public/index.ts index 4b330600417e7d..a000658a59f6bd 100644 --- a/src/plugins/data/public/index.ts +++ b/src/plugins/data/public/index.ts @@ -92,6 +92,7 @@ export { getKbnTypeNames, // utils parseInterval, + isNestedField, } from '../common'; // Export plugin after all other imports diff --git a/src/plugins/data/server/index.ts b/src/plugins/data/server/index.ts index 3cd088744a4391..ab908f90fc87b0 100644 --- a/src/plugins/data/server/index.ts +++ b/src/plugins/data/server/index.ts @@ -49,6 +49,7 @@ export { TimeRange, // utils parseInterval, + isNestedField, } from '../common'; /** diff --git a/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts b/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts index 43425077cc174d..0bef31e9fb7fe6 100644 --- a/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts +++ b/x-pack/legacy/plugins/graph/public/services/persistence/deserialize.ts @@ -24,7 +24,7 @@ import { colorChoices, iconChoicesByClass, } from '../../helpers/style_choices'; -import { IndexPattern } from '../../../../../../../src/plugins/data/public'; +import { IndexPattern, isNestedField } from '../../../../../../../src/plugins/data/public'; const defaultAdvancedSettings: AdvancedSettings = { useSignificance: true, @@ -80,7 +80,7 @@ export function mapFields(indexPattern: IndexPattern): WorkspaceField[] { return indexPattern .getNonScriptedFields() - .filter(field => !blockedFieldNames.includes(field.name)) + .filter(field => !blockedFieldNames.includes(field.name) && !isNestedField(field)) .map((field, index) => ({ name: field.name, hopSize: defaultHopSize, diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts index c196cb886e575b..b9e166da3b01a4 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/loader.ts @@ -21,6 +21,7 @@ import { updateLayerIndexPattern } from './state_helpers'; import { DateRange, ExistingFields } from '../../common/types'; import { BASE_API_URL } from '../../common'; import { documentField } from './document_field'; +import { isNestedField, IFieldType } from '../../../../../../src/plugins/data/public'; interface SavedIndexPatternAttributes extends SavedObjectAttributes { title: string; @@ -270,9 +271,9 @@ function fromSavedObject( id, type, title: attributes.title, - fields: (JSON.parse(attributes.fields) as IndexPatternField[]) - .filter(({ aggregatable, scripted }) => !!aggregatable || !!scripted) - .concat(documentField), + fields: (JSON.parse(attributes.fields) as IFieldType[]) + .filter(field => !isNestedField(field) && (!!field.aggregatable || !!field.scripted)) + .concat(documentField) as IndexPatternField[], typeMeta: attributes.typeMeta ? (JSON.parse(attributes.typeMeta) as SavedRestrictionsInfo) : undefined, diff --git a/x-pack/legacy/plugins/maps/public/connected_components/gis_map/view.js b/x-pack/legacy/plugins/maps/public/connected_components/gis_map/view.js index 64342d6b4b51d6..2430ca6503f848 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/gis_map/view.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/gis_map/view.js @@ -15,6 +15,7 @@ import { EuiFlexGroup, EuiFlexItem, EuiCallOut } from '@elastic/eui'; import { ExitFullScreenButton } from 'ui/exit_full_screen'; import { getIndexPatternsFromIds } from '../../index_pattern_util'; import { ES_GEO_FIELD_TYPE } from '../../../common/constants'; +import { isNestedField } from '../../../../../../../src/plugins/data/public'; import { i18n } from '@kbn/i18n'; import uuid from 'uuid/v4'; @@ -80,8 +81,9 @@ export class GisMap extends Component { indexPatterns.forEach(indexPattern => { indexPattern.fields.forEach(field => { if ( - field.type === ES_GEO_FIELD_TYPE.GEO_POINT || - field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE + !isNestedField(field) && + (field.type === ES_GEO_FIELD_TYPE.GEO_POINT || + field.type === ES_GEO_FIELD_TYPE.GEO_SHAPE) ) { geoFields.push({ geoFieldName: field.name, diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join.js b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join.js index f5738856bd8dba..554164bf0e8c4b 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join.js @@ -13,6 +13,7 @@ import { MetricsExpression } from './metrics_expression'; import { WhereExpression } from './where_expression'; import { GlobalFilterCheckbox } from '../../../../components/global_filter_checkbox'; +import { isNestedField } from '../../../../../../../../../src/plugins/data/public'; import { indexPatternService } from '../../../../kibana_services'; const getIndexPatternId = props => { @@ -88,7 +89,7 @@ export class Join extends Component { } this.setState({ - rightFields: indexPattern.fields, + rightFields: indexPattern.fields.filter(field => !isNestedField(field)), indexPattern, }); } diff --git a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js index b53a0e737fc3d4..76827e71df9ec8 100644 --- a/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js +++ b/x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join_expression.js @@ -23,6 +23,7 @@ import { getTermsFields } from '../../../../index_pattern_util'; import { indexPatternService } from '../../../../kibana_services'; import { npStart } from 'ui/new_platform'; +import { isNestedField } from '../../../../../../../../../src/plugins/data/public'; const { IndexPatternSelect } = npStart.plugins.data.ui; export class JoinExpression extends Component { @@ -134,7 +135,7 @@ export class JoinExpression extends Component { } const filterStringOrNumberFields = field => { - return field.type === 'string' || field.type === 'number'; + return (field.type === 'string' && !isNestedField(field)) || field.type === 'number'; }; return ( diff --git a/x-pack/legacy/plugins/maps/public/index_pattern_util.js b/x-pack/legacy/plugins/maps/public/index_pattern_util.js index c16606525b8c18..10837bc2f0d0c8 100644 --- a/x-pack/legacy/plugins/maps/public/index_pattern_util.js +++ b/x-pack/legacy/plugins/maps/public/index_pattern_util.js @@ -5,6 +5,7 @@ */ import { indexPatternService } from './kibana_services'; +import { isNestedField } from '../../../../../src/plugins/data/public'; export async function getIndexPatternsFromIds(indexPatternIds = []) { const promises = []; @@ -20,7 +21,11 @@ export async function getIndexPatternsFromIds(indexPatternIds = []) { export function getTermsFields(fields) { return fields.filter(field => { - return field.aggregatable && ['number', 'boolean', 'date', 'ip', 'string'].includes(field.type); + return ( + field.aggregatable && + !isNestedField(field) && + ['number', 'boolean', 'date', 'ip', 'string'].includes(field.type) + ); }); } @@ -29,6 +34,6 @@ export function getSourceFields(fields) { return fields.filter(field => { // Multi fields are not stored in _source and only exist in index. const isMultiField = field.subType && field.subType.multi; - return !isMultiField; + return !isMultiField && !isNestedField(field); }); } diff --git a/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js b/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js index f9baf180dfe5ce..76bcb8da552d1c 100644 --- a/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js +++ b/x-pack/legacy/plugins/maps/public/layers/fields/es_doc_field.js @@ -7,13 +7,15 @@ import { AbstractField } from './field'; import { ESTooltipProperty } from '../tooltips/es_tooltip_property'; import { COLOR_PALETTE_MAX_SIZE } from '../../../common/constants'; +import { isNestedField } from '../../../../../../../src/plugins/data/public'; export class ESDocField extends AbstractField { static type = 'ES_DOC'; async _getField() { const indexPattern = await this._source.getIndexPattern(); - return indexPattern.fields.getByName(this._fieldName); + const field = indexPattern.fields.getByName(this._fieldName); + return isNestedField(field) ? undefined : field; } async createTooltipProperty(value) { diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js index 484d9853b88cd8..b53223bff8b45f 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/create_source_editor.js @@ -16,6 +16,7 @@ import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiComboBox, EuiSpacer } from '@elastic/eui'; import { ES_GEO_FIELD_TYPE } from '../../../../common/constants'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; import { npStart } from 'ui/new_platform'; const { IndexPatternSelect } = npStart.plugins.data.ui; @@ -115,7 +116,9 @@ export class CreateSourceEditor extends Component { }); //make default selection - const geoFields = indexPattern.fields.filter(filterGeoField); + const geoFields = indexPattern.fields + .filter(field => !isNestedField(field)) + .filter(filterGeoField); if (geoFields[0]) { this._onGeoFieldSelect(geoFields[0].name); } @@ -171,7 +174,11 @@ export class CreateSourceEditor extends Component { value={this.state.geoField} onChange={this._onGeoFieldSelect} filterField={filterGeoField} - fields={this.state.indexPattern ? this.state.indexPattern.fields : undefined} + fields={ + this.state.indexPattern + ? this.state.indexPattern.fields.filter(field => !isNestedField(field)) + : undefined + } /> ); diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/update_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/update_source_editor.js index 6faed55f24c343..0d9234acd91500 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/update_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_geo_grid_source/update_source_editor.js @@ -14,6 +14,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { isMetricCountable } from '../../util/is_metric_countable'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; export class UpdateSourceEditor extends Component { state = { @@ -51,7 +52,7 @@ export class UpdateSourceEditor extends Component { return; } - this.setState({ fields: indexPattern.fields }); + this.setState({ fields: indexPattern.fields.filter(field => !isNestedField(field)) }); } _onMetricsChange = metrics => { diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js index 6180862d01bba6..85d63c9da8a311 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/create_source_editor.js @@ -15,6 +15,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFormRow, EuiCallOut } from '@elastic/eui'; import { ES_GEO_FIELD_TYPE } from '../../../../common/constants'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; import { npStart } from 'ui/new_platform'; const { IndexPatternSelect } = npStart.plugins.data.ui; @@ -91,7 +92,9 @@ export class CreateSourceEditor extends Component { return; } - const geoFields = indexPattern.fields.filter(filterGeoField); + const geoFields = indexPattern.fields + .filter(field => !isNestedField(field)) + .filter(filterGeoField); this.setState({ isLoadingIndexPattern: false, @@ -163,7 +166,11 @@ export class CreateSourceEditor extends Component { value={this.state.destGeoField} onChange={this._onDestGeoSelect} filterField={filterGeoField} - fields={this.state.indexPattern ? this.state.indexPattern.fields : undefined} + fields={ + this.state.indexPattern + ? this.state.indexPattern.fields.filter(field => !isNestedField(field)) + : undefined + } /> diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js index dfc9fca96dd759..e6faf4146435d9 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/es_pew_pew_source.js @@ -25,6 +25,7 @@ import { AggConfigs } from 'ui/agg_types'; import { AbstractESAggSource } from '../es_agg_source'; import { DynamicStyleProperty } from '../../styles/vector/properties/dynamic_style_property'; import { COLOR_GRADIENTS } from '../../styles/color_utils'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; const MAX_GEOTILE_LEVEL = 29; @@ -228,7 +229,8 @@ export class ESPewPewSource extends AbstractESAggSource { async _getGeoField() { const indexPattern = await this.getIndexPattern(); - const geoField = indexPattern.fields.getByName(this._descriptor.destGeoField); + const field = indexPattern.fields.getByName(this._descriptor.destGeoField); + const geoField = isNestedField(field) ? undefined : field; if (!geoField) { throw new Error( i18n.translate('xpack.maps.source.esSource.noGeoFieldErrorMessage', { diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/update_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/update_source_editor.js index 028bb3ad6c7f21..6e2583bf85bb88 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/update_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_pew_pew_source/update_source_editor.js @@ -11,6 +11,7 @@ import { indexPatternService } from '../../../kibana_services'; import { i18n } from '@kbn/i18n'; import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; export class UpdateSourceEditor extends Component { state = { @@ -48,7 +49,7 @@ export class UpdateSourceEditor extends Component { return; } - this.setState({ fields: indexPattern.fields }); + this.setState({ fields: indexPattern.fields.filter(field => !isNestedField(field)) }); } _onMetricsChange = metrics => { diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js index 28045eeb5e9b52..69e4c09eed1180 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/create_source_editor.js @@ -21,6 +21,7 @@ import { DEFAULT_MAX_RESULT_WINDOW, } from '../../../../common/constants'; import { DEFAULT_FILTER_BY_MAP_BOUNDS } from './constants'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; import { npStart } from 'ui/new_platform'; const { IndexPatternSelect } = npStart.plugins.data.ui; @@ -124,7 +125,9 @@ export class CreateSourceEditor extends Component { }); //make default selection - const geoFields = indexPattern.fields.filter(filterGeoField); + const geoFields = indexPattern.fields + .filter(field => !isNestedField(field)) + .filter(filterGeoField); if (geoFields[0]) { this.onGeoFieldSelect(geoFields[0].name); } @@ -178,7 +181,11 @@ export class CreateSourceEditor extends Component { value={this.state.geoField} onChange={this.onGeoFieldSelect} filterField={filterGeoField} - fields={this.state.indexPattern ? this.state.indexPattern.fields : undefined} + fields={ + this.state.indexPattern + ? this.state.indexPattern.fields.filter(field => !isNestedField(field)) + : undefined + } /> ); diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/update_source_editor.js b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/update_source_editor.js index 4503856829ef25..fdebbe4c819110 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/update_source_editor.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/es_search_source/update_source_editor.js @@ -26,6 +26,7 @@ import { DEFAULT_MAX_INNER_RESULT_WINDOW, SORT_ORDER } from '../../../../common/ import { ESDocField } from '../../fields/es_doc_field'; import { FormattedMessage } from '@kbn/i18n/react'; import { loadIndexSettings } from './load_index_settings'; +import { isNestedField } from '../../../../../../../../src/plugins/data/public'; export class UpdateSourceEditor extends Component { static propTypes = { @@ -103,7 +104,7 @@ export class UpdateSourceEditor extends Component { this.setState({ sourceFields: sourceFields, termFields: getTermsFields(indexPattern.fields), //todo change term fields to use fields - sortFields: indexPattern.fields.filter(field => field.sortable), //todo change sort fields to use fields + sortFields: indexPattern.fields.filter(field => field.sortable && !isNestedField(field)), //todo change sort fields to use fields }); } _onTooltipPropertiesChange = propertyNames => {