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

[ML] Add better UI support for runtime fields Transforms #90363

Merged
merged 44 commits into from
Feb 17, 2021

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Feb 4, 2021

Summary

This PR adds better support for Transform and Data Frame Analytics on the UI side. Changes include:

Transforms

  • Support cloning transform job that includes runtime_mappings
  • Support creating and cloning transform job where index pattern has runtime fields (can be defined via Index pattern field editor - Load and save fields #89390)
  • Copy the search-time runtime_mappings over to the index pattern if user opts to create new index pattern from wizard
  • Add an advanced editor so that all search-time runtime_mappings (either from index pattern or from API) will be editable
  • Fix the oversized buttons in the Filter -> Range controls

Editor
Screen Shot 2021-02-10 at 09 25 06

Pivot
Screen Shot 2021-02-04 at 17 13 54

  • Filter terms list the values correctly for runtime fields

Screen Shot 2021-02-09 at 11 57 46

Latest

Screen Shot 2021-02-04 at 17 25 55

Previews

localhost_5601_abc_app_management_data_transform_

Data Frame Analytics

  • Support previews in Data Frame Analytics index data
  • Add callout message for unsupported fields for Data Frame Analytics wizard

Screen Shot 2021-02-05 at 11 47 32

Todos:

Screen Shot 2021-02-14 at 15 07 50

Checklist

Delete any items that are not applicable to this PR.

@walterra
Copy link
Contributor

walterra commented Feb 8, 2021

I tried to clone the job fq_runtime_mappings_transform from the "Transforms examples (7.12+)" section in the "Runtime fields investigation" document we have.

When I start cloning, the source table correctly shows the runtime fields. However, the preview doesn't return any results.

image

When I copy the preview configuration using the copy-to-clipboard button, it's missing the runtime fields config:

POST _transform/_preview
{
  "source": {
    "index": [
      "farequote-2019"
    ]
  },
  "pivot": {
    "group_by": {
      "airline": {
        "terms": {
          "field": "airline-lower"
        }
      }
    },
    "aggregations": {
      "responsetime.avg": {
        "avg": {
          "field": "responsetime"
        }
      },
      "responsetime.max": {
        "max": {
          "field": "responsetime"
        }
      },
      "@timestamp.value_count": {
        "value_count": {
          "field": "@timestamp"
        }
      },
      "responsetime.min": {
        "min": {
          "field": "responsetime"
        }
      }
    }
  }
}

However, I can move on in the wizard and create the job, it gets cloned including the runtime field settings successfully:

image

@peteharverson
Copy link
Contributor

Testing using an index pattern for which I've set up two runtime fields, runtime_big and airline_lower. I only get to see one of the aggs I've set up on the runtime field, and as @walterra found, I don't see the runtime_mapping section in the 'copy to clipboard' JSON:

image

@qn895
Copy link
Member Author

qn895 commented Feb 8, 2021

I tried to clone the job fq_runtime_mappings_transform from the "Transforms examples (7.12+)" section in the "Runtime fields investigation" document we have.

Thanks for testing. The issue with the preview as well as copy to console should be fixed in the latest changes.

Screen Shot 2021-02-08 at 10 46 12

Testing using an index pattern for which I've set up two runtime fields, runtime_big and airline_lower. I only get to see one of the aggs I've set up on the runtime field...

There's currently an issue with showing min/max aggregation for these runtime fields which is being tracked here elastic/elasticsearch#68516

@qn895 qn895 removed the request for review from a team February 14, 2021 21:42
Comment on lines 479 to 482
unsupportedRuntimeFields:
unsupportedRuntimeFields.length > 5
? unsupportedRuntimeFields.slice(0, 5).join(', ')
: unsupportedRuntimeFields.join(', '),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need in this check, slice doesn't add extra values to an array

Suggested change
unsupportedRuntimeFields:
unsupportedRuntimeFields.length > 5
? unsupportedRuntimeFields.slice(0, 5).join(', ')
: unsupportedRuntimeFields.join(', '),
unsupportedRuntimeFields: unsupportedRuntimeFields.slice(0, 5).join(', ')

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 7b91ae0

values={{
runtimeFieldsCount: unsupportedRuntimeFields.length,
extraCountMsg:
unsupportedRuntimeFields.length - 5 > 0 ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid magic numbers, worth creating a constant const maxRuntimeFieldsDisplayCount = 5; or something like this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 7b91ae0

<EuiCallOut size="s" color="warning">
<FormattedMessage
id="xpack.ml.dataframe.analytics.create.unsupportedRuntimeFieldsCallout"
defaultMessage="The runtime {runtimeFieldsCount, plural, one {field} other {fields}} {unsupportedRuntimeFields} {extraCountMsg} are not supported for analysis."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, in case {extraCountMsg} is empty, the sentence ends up with 2 spaces before are not supported for analysis string. I think and {count} more message should take care of adding a space.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the extra space to extraCountMsg will actually be stripped out. For example, this is what I looks like with the spaces in extraCountMsg.
Screen Shot 2021-02-16 at 10 52 29

And this is what it looks like as is:
Screen Shot 2021-02-16 at 10 32 30

</EuiText>
<EuiSpacer size="s" />
<EuiButton
style={{ width: 'fit-content' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it doesn't break the layout, let's keep it as is

@peteharverson
Copy link
Contributor

Can the fields in the aggregations dropdown be sorted alphabetically prior to display? Currently it looks like the runtime fields are appended to the end of the list:

image

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qn895 qn895 added the auto-backport Deprecated - use backport:version if exact versions are needed label Feb 16, 2021
@qn895
Copy link
Member Author

qn895 commented Feb 16, 2021

Can the fields in the aggregations dropdown be sorted alphabetically prior to display? Currently it looks like the runtime fields are appended to the end of the list:

This is now sorted alphabetically here 7b91ae0

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1738 1739 +1
transform 214 221 +7
total +8

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
ml 6.3MB 6.3MB +5.5KB
transform 925.3KB 942.1KB +16.8KB
total +22.3KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@qn895 qn895 merged commit 63ac0f7 into elastic:master Feb 17, 2021
@kibanamachine
Copy link
Contributor

💔 Backport failed

❌ 7.x: Commit could not be cherrypicked due to conflicts

To backport manually, check out the target branch and run:
node scripts/backport --pr 90363

gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 17, 2021
* master: (157 commits)
  [DOCS] Adds machine learning to the security section of alerting (elastic#91501)
  [Uptime] Ping list step screenshot caption formatting (elastic#91403)
  [Vislib] Use timestamp on brush event instead of iso dates (elastic#91483)
  [Application Usage] Remove deprecated & unused legacy.appChanged API (elastic#91464)
  Migrate logstash, monitoring, url_drilldowns, xpack_legacy to ts projects (elastic#91194)
  [APM] Wrap Elasticsearch client errors (elastic#91125)
  [APM] Fix optimize-tsconfig script (elastic#91487)
  [Discover][docs] Add searchFieldsFromSource description (elastic#90980)
  Adds support for 'ip' data type (elastic#85087)
  [Detection Rules] Add updates from 7.11.2 rules (elastic#91553)
  [SECURITY SOLUTION] Eql in timeline (elastic#90816)
  [APM] Correlations Beta (elastic#86477) (elastic#89952)
  [Security Solutions][Detection Engine] Adds a warning banner when the alerts data has not been migrated yet. (elastic#90258)
  [Security Solution] [Timeline] Endpoint row renderers (2nd batch) (elastic#91446)
  skip flaky suite (elastic#91450)
  skip flaky suite (elastic#91592)
  [Security Solution][Endpoint][Admin] Endpoint Details UX Enhancements (elastic#90870)
  [ML] Add better UI support for runtime fields Transforms  (elastic#90363)
  [Security Solution] [Detections] Replace 'partial failure' with 'warning' for rule statuses (elastic#91167)
  [Security Solution][Detections] Adds Indicator path config for indicator match rules (elastic#91260)
  ...
qn895 added a commit to qn895/kibana that referenced this pull request Feb 17, 2021
* [ML] Add RT support for transforms from index pattern

* [ML] Add support for cloned transform from api

* [ML] Add support for runtime pivot

* [ML] Add support for api created runtime

* [ML] Add preview for expanded row

* [ML] Add runtime fields to dropdown options

* [ML] Add runtime fields to latest

* [ML] Fix duplicate columns

* [ML] Update types and test

* [ML] Add runtime mappings to index pattern on creation

* [ML] Add callout to show unsupported fields in dfa

* [ML] Update types to RuntimeField

* [ML] Fix runtime fields, remove runtime mappings, fix copy to console

* [ML] Fix incompatible kbn field type

* [ML] Add advanced mappings editor

* [ML] Add support for filter terms agg control

* [ML] Fix jest tests hanging

* [ML] Fix translations

* [ML] Fix over-sized buttons for filter range

* [ML] Update runtime mappings schema

* [ML] Update runtime mappings schema

* [ML] Use isRecord for object checks

* [ML] Fix and more message

* [ML] Update schema to correctly match types

* [ML] Update schema to correctly match types

* [ML] Fix pivot duplicates

* [ML] Rename isRecord to isPopulatedObject

* [ML] Remove fit-content

* [ML] Update runtime field type to prevent potential conflicts

* Revert "[ML] Remove fit-content"

This reverts commit 76c9c79

* [ML] Remove misc comment

* [ML] Fix missing typeof

* [ML] Add sorts and constants

* [ML] Add i18n to includedFields description

* [ML] fix imports

* [ML] Only pass runtime mappings if it's latest

* [ML] Fix functional tests
walterra pushed a commit that referenced this pull request Feb 17, 2021
…1636)

* [ML] Add RT support for transforms from index pattern

* [ML] Add support for cloned transform from api

* [ML] Add support for runtime pivot

* [ML] Add support for api created runtime

* [ML] Add preview for expanded row

* [ML] Add runtime fields to dropdown options

* [ML] Add runtime fields to latest

* [ML] Fix duplicate columns

* [ML] Update types and test

* [ML] Add runtime mappings to index pattern on creation

* [ML] Add callout to show unsupported fields in dfa

* [ML] Update types to RuntimeField

* [ML] Fix runtime fields, remove runtime mappings, fix copy to console

* [ML] Fix incompatible kbn field type

* [ML] Add advanced mappings editor

* [ML] Add support for filter terms agg control

* [ML] Fix jest tests hanging

* [ML] Fix translations

* [ML] Fix over-sized buttons for filter range

* [ML] Update runtime mappings schema

* [ML] Update runtime mappings schema

* [ML] Use isRecord for object checks

* [ML] Fix and more message

* [ML] Update schema to correctly match types

* [ML] Update schema to correctly match types

* [ML] Fix pivot duplicates

* [ML] Rename isRecord to isPopulatedObject

* [ML] Remove fit-content

* [ML] Update runtime field type to prevent potential conflicts

* Revert "[ML] Remove fit-content"

This reverts commit 76c9c79

* [ML] Remove misc comment

* [ML] Fix missing typeof

* [ML] Add sorts and constants

* [ML] Add i18n to includedFields description

* [ML] fix imports

* [ML] Only pass runtime mappings if it's latest

* [ML] Fix functional tests
@qn895 qn895 mentioned this pull request Feb 18, 2021
12 tasks
@qn895 qn895 deleted the ml-transforms-df-runtime branch February 23, 2021 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Data Frame Analytics ML data frame analytics features Feature:Transforms ML transforms :ml release_note:enhancement v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants