[Unified Search] Replacement deprecated methods in Unified Search #131292
Labels
Feature:Unified search
Unified search related tasks
Team:Visualizations
Visualization editors, elastic-charts and infrastructure
Describe the feature:
According to the PR #124063 the
DataViews
service was broken out of theData
plugin into its own plugin. According to the pull request #128168 we should cleanup the deprecatedIndexPattern
service and use theDataViews
one and replace the deprecated methods fromData
plugin.In PR #130008, it was revealed that due to the depends of the plugins, we cannot achieve the task by completely replacing the obsolete index patter method with the date view.
There are following issues:
1. Replacement of IndexPattern to DataVIew:
— Inside
Lens
plugin there are declarationed and used interfacesIndexPattern
andIndexPatternField
. They are not inherited or imported fromData
orDataView
additions, but have their own implementations insideLens
plugin.— Inside
Infra
plugin there is its own method for creating —createDerivedIndexPattern
. Moreover in this pluginindexPattern
mostly inherited fromDataViewBase
.— In the file
x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx
inside the pluginapm
it is used the method fromUnified search
plugin —getQuerySuggestions
, which useIndexPattern
as one of the parameters.In this plugin it is used its own method of creating
DataView
(IndexPattern
) —useDynamicDataViewFetcher
, which dynamically loads the type. It is not inherited or imported fromData
orDataView
additions, but have its own implementations.— In
Fleet
plugin it is clearly set a value ofindexPattern
asAll mentioned issues are creating difficulty for replacing
IndexPattern
toDataView
inUnified search
plugin.2. Replacement of IFieldType to DataViewFiled:
— According to the description in
src/plugins/data_views/common/fields/types.ts
, the typeIFieldType extends DataViewFieldBase
. The typeIFieldType
has deprecated and it is necessary to useIndexPatternField
.At the same time, according to
src/plugins/data_views/common/fields/data_view_field.ts
IndexPatternField
also has deprecated and its necessary to replace it toDataViewField
. However, classDataViewField
implementsIFieldType
.Because of this kind of dependence in some plugins instead of
IFieldType
it is usedDataViewFieldBase
.Because of this, it is impossible to directly replace
IFieldType
toDataViewFiled
.At the same time, in some plugins instead of
DataViewField
it is usedFieldSpec
, which is extension ofDataViewFieldBase
.FieldSpec
is also deprecated and according to the annotation, it is suggested to replace it toIndexPatternField
, which is also deprecated and should be replaced toDataViewField
.It is necessary to cast all properties to the same types so that deprecated methods can be replaced.
— In interface
IFieldType
all properties are optional, when inDataViewField
properties are required. This creates difficulties in replacingIFieldType
toDataViewField
. Because when using methods from plugins,TypeScripts
shows an error that the passed values are not completely set for this type.— Inside the interface
IIndexPattern
src/plugins/data_views/common/types.ts
there are properties and methods, which have deprecated typeIFieldType
. Because of this while replacingIFieldType
toDataViewFiled
TypeScripts
shows an error about type incompatibilities.All of the above issues make it difficult to replace
IFieldType
toDataViewFiled
inUnified search
plugin.3. Replacement of deprecated import esFilters. :
as #130008 (review)
In
Unified search
it is used an import fromData
plugin of deprecatedesFilters
-extractTimeFilter
andchangeTimeFilter
. To solve this issues, we propose to moveextractTimeFilter
andchangeTimeFilter
fromData
toUnified search
plugin, which is used only inUnified search
. However, if we transferextractTimeFilter
andchangeTimeFilter
, we will have to transfer related functions. One of themextractTimeRange
is used in other plugins. Our suggestion is to moveextractTimeRange
to the separated packagekbn-es-query
.After completing the above tasks, we will be able to completely replace
IndexPattern
toDataView
and replace the deprecated methods fromUnified search
.The text was updated successfully, but these errors were encountered: