-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Transforms: Migrate IndexPattern service usage to DataView service #128247
[ML] Transforms: Migrate IndexPattern service usage to DataView service #128247
Conversation
Pinging @elastic/ml-ui (:ml) |
Tested and LGTM 🎉 |
@@ -5,18 +5,18 @@ | |||
* 2.0. | |||
*/ | |||
|
|||
import type { IndexPattern } from '../../../../../src/plugins/data/common'; | |||
import { DataView } from '../../../../../src/plugins/data_views/common'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the type
part here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b846d83
@@ -8,7 +8,7 @@ | |||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; | |||
|
|||
import { HttpFetchError } from '../../../../../../src/core/public'; | |||
import type { IndexPattern } from '../../../../../../src/plugins/data/public'; | |||
import { DataView } from '../../../../../../src/plugins/data_views/public'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the type
part here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in b846d83
const isMissingFields = resp.hits.hits.every((d) => typeof d.fields === 'undefined'); | ||
|
||
const docs = resp.hits.hits.map((d) => getProcessedFields(d.fields ?? {})); | ||
|
||
// Get all field names for each returned doc and flatten it | ||
// to a list of unique field names used across all docs. | ||
const allKibanaIndexPatternFields = getFieldsFromKibanaIndexPattern(indexPattern); | ||
const allKibanaDataViewFields = getFieldsFromKibanaIndexPattern(dataView); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KibanaIndexPattern
was used to distinguish between raw string based index patterns and a Kibana maintained index pattern object. So suggest to now name this just allDataViewFields
since DataView
is a Kibana-only thing anyway. I see getFieldsFromKibanaIndexPattern
is brought over from the ml
plugin so this will be done in another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to allDataViewFields
in b846d83. Yes I have left the remaining IndexPattern
to DataView
function / variable renaming in the ml
plugin for a follow-up :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, just added small nit suggestions.
b846d83
to
85f7b30
Compare
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
Summary
The DataViews service has been broken out of the data plugin into the
data_views
plugin. This PR replaces all usage of the now deprecatedindexPatterns
API in thetransform
plugin with theDataView
API.As well as updating imports, most of the uses of
indexPattern
type parameter and function names have been replaced todataView
.Note that related changes to functional test function names have been kept to a minimum to reduce the code churn in this PR.
Part of #124063 and #124092
Checklist