From 69e47bb9c6b1914abc7bb88700754e84b609b4ee Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Wed, 26 Jan 2022 13:31:22 +0100 Subject: [PATCH] disable suggestions for version fields --- .../providers/value_suggestion_provider.ts | 9 ++++++++- .../ui/filter_bar/filter_editor/phrase_suggestor.tsx | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts index 31f886daeb4cc..f88fd3b9a0157 100644 --- a/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts +++ b/src/plugins/data/public/autocomplete/providers/value_suggestion_provider.ts @@ -103,9 +103,16 @@ export const setupValueSuggestionProvider = ( useTimeRange ?? core!.uiSettings.get(UI_SETTINGS.AUTOCOMPLETE_USE_TIMERANGE); const { title } = indexPattern; + const isVersionFieldType = field.type === 'string' && field.esTypes?.includes('version'); + if (field.type === 'boolean') { return [true, false]; - } else if (!shouldSuggestValues || !field.aggregatable || field.type !== 'string') { + } else if ( + !shouldSuggestValues || + !field.aggregatable || + field.type !== 'string' || + isVersionFieldType // suggestions don't work for version fields + ) { return []; } diff --git a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx index 2dff5acedb24a..ba39ee78dafa4 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_editor/phrase_suggestor.tsx @@ -54,7 +54,15 @@ export class PhraseSuggestorUI extends React.Com UI_SETTINGS.FILTERS_EDITOR_SUGGEST_VALUES ); const { field } = this.props; - return shouldSuggestValues && field && field.aggregatable && field.type === 'string'; + const isVersionFieldType = field?.esTypes?.includes('version'); + + return ( + shouldSuggestValues && + field && + field.aggregatable && + field.type === 'string' && + !isVersionFieldType // suggestions don't work for version fields + ); } protected onSearchChange = (value: string | number | boolean) => {