Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unified Search] Replacement deprecated methods in Unified Search #131292

Closed
nlatipov opened this issue May 1, 2022 · 2 comments
Closed

[Unified Search] Replacement deprecated methods in Unified Search #131292

nlatipov opened this issue May 1, 2022 · 2 comments
Assignees
Labels
Feature:Unified search Unified search related tasks Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@nlatipov
Copy link
Contributor

nlatipov commented May 1, 2022

Describe the feature:

According to the PR #124063 the DataViews service was broken out of the Data plugin into its own plugin. According to the pull request #128168 we should cleanup the deprecated IndexPattern service and use the DataViews one and replace the deprecated methods from Data 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 interfaces IndexPattern and IndexPatternField. They are not inherited or imported from Data or DataView additions, but have their own implementations inside Lens plugin.

— Inside Infra plugin there is its own method for creating — createDerivedIndexPattern. Moreover in this plugin indexPattern mostly inherited from DataViewBase.

— In the file x-pack/plugins/apm/public/components/shared/kuery_bar/index.tsx inside the plugin apm it is used the method from Unified search plugin — getQuerySuggestions, which use IndexPattern 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 from Data or DataView additions, but have its own implementations.

— In Fleet plugin it is clearly set a value of indexPattern as

indexPattern: {
    title: AGENT_LOG_INDEX_PATTERN,
    fields: [LOG_LEVEL_FIELD],
},

All mentioned issues are creating difficulty for replacing IndexPattern to DataView in Unified search plugin.

2. Replacement of IFieldType to DataViewFiled:

— According to the description in src/plugins/data_views/common/fields/types.ts, the type IFieldType extends DataViewFieldBase. The type IFieldType has deprecated and it is necessary to use IndexPatternField.
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 to DataViewField. However, class DataViewField implements IFieldType.
Because of this kind of dependence in some plugins instead of IFieldType it is used DataViewFieldBase.
Because of this, it is impossible to directly replace IFieldType to DataViewFiled.

At the same time, in some plugins instead of DataViewField it is used FieldSpec, which is extension of DataViewFieldBase. FieldSpec is also deprecated and according to the annotation, it is suggested to replace it to IndexPatternField, which is also deprecated and should be replaced to DataViewField.
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 in DataViewField properties are required. This creates difficulties in replacing IFieldType to DataViewField. 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 type IFieldType. Because of this while replacing IFieldType to DataViewFiled TypeScripts shows an error about type incompatibilities.

All of the above issues make it difficult to replace IFieldType to DataViewFiled in Unified search plugin.

3. Replacement of deprecated import esFilters. :

as #130008 (review)

In Unified search it is used an import from Data plugin of deprecated esFilters - extractTimeFilter and changeTimeFilter. To solve this issues, we propose to move extractTimeFilter and changeTimeFilter from Data to Unified search plugin, which is used only in Unified search. However, if we transfer extractTimeFilter and changeTimeFilter, we will have to transfer related functions. One of them extractTimeRange is used in other plugins. Our suggestion is to move extractTimeRange to the separated package kbn-es-query.

After completing the above tasks, we will be able to completely replace IndexPattern to DataView and replace the deprecated methods from Unified search.

@nlatipov nlatipov added Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Unified search Unified search related tasks labels May 1, 2022
@nlatipov nlatipov self-assigned this May 1, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@nlatipov nlatipov changed the title [Unified Search] Change deprecated methods in Unified search [Unified Search] Replacement deprecated methods in Unified Search May 3, 2022
@alexwizp alexwizp added the WIP Work in progress label May 20, 2022
@alexwizp alexwizp removed the WIP Work in progress label Jun 6, 2022
@alexwizp alexwizp assigned alexwizp and unassigned nlatipov Jun 7, 2022
@alexwizp
Copy link
Contributor

alexwizp commented Jun 8, 2022

was fixed in scope of #133086

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Unified search Unified search related tasks Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

3 participants