Skip to content

[ML] Add runtime fields support#78700

Merged
qn895 merged 14 commits intoelastic:masterfrom
qn895:ml-add-runtime-fields-support
Oct 5, 2020
Merged

[ML] Add runtime fields support#78700
qn895 merged 14 commits intoelastic:masterfrom
qn895:ml-add-runtime-fields-support

Conversation

@qn895
Copy link
Copy Markdown
Member

@qn895 qn895 commented Sep 28, 2020

Summary

This PR is part of #77462 to add support for runtime fields. Instead of querying for fields using _source, it instead uses the new fields API https://www.elastic.co/guide/en/elasticsearch/reference/master/search-fields.html#search-fields-param.

However, there are some limitations. Because the values are returned as a flat list in the fields section in each hit, we are keeping the results field under source to maintain the shape of the records.

ML

  • Source data grid table cells are empty for runtime fields defined in the mappings that are not present in _source
  • Anomaly detection datafeed preview uses _source (advanced wizard, jobs list)
  • Categorization job wizard prevents use of a runtime field defined in the mappings that is not present in _source, failing at the No examples for this field could be found step
  • Testing a custom_url which uses a runtime field for a job which has not yet created anomalies looks for field _source

Transforms

  • Source data grid table cells are empty for runtime fields defined in the mappings that are not present in _source (example below responsetimeplus is a runtime field)

  • This was checked for cross-browser compatibility

@qn895 qn895 added :ml Feature:Anomaly Detection ML anomaly detection Feature:Data Frame Analytics ML data frame analytics features labels Sep 28, 2020
@qn895 qn895 self-assigned this Sep 28, 2020
@qn895 qn895 changed the title [ML] WIP Add runtime fields support [ML] WIP - Add runtime fields support Sep 28, 2020
@qn895 qn895 changed the title [ML] WIP - Add runtime fields support [ML] Add runtime fields support Oct 1, 2020
@qn895 qn895 marked this pull request as ready for review October 1, 2020 17:18
@qn895 qn895 requested a review from a team as a code owner October 1, 2020 17:18
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui (:ml)

@qn895 qn895 added release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0 labels Oct 1, 2020
@qn895
Copy link
Copy Markdown
Member Author

qn895 commented Oct 1, 2020

@elasticmachine merge upstream

@peteharverson peteharverson removed the release_note:skip Skip the PR/issue when compiling release notes label Oct 2, 2020
Copy link
Copy Markdown
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested and LGTM

values: { percent: NULL_COUNT_PERCENT_LIMIT * 100 },
}),
});
// add check so message won't be added if all values are null
Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic Oct 2, 2020

Choose a reason for hiding this comment

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

if 100% of field valuess are null, why do we not want to report this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry I should have been clearer in the comment.

Currently, if all values are null, the message we are giving back is: 'No examples for this field could be found. Please ensure the selected date range contains data.'

The added check here ensures we only give that one message back instead of both 'More than 75% of field values are null.' and 'No examples for this field could be found.'

Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic Oct 5, 2020

Choose a reason for hiding this comment

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

ok makes sense.
It think it might worth adding something to this comment for future readers. Something like:

If all values are null, VALIDATION_RESULT.NO_EXAMPLES will be raised. 
So we don't need to display this warning as well

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks. Updated the comment to be more explicit here. 219c661

}, {} as EsSorting);

const { pageIndex, pageSize } = pagination;
// TODO: remove results_field from `fields` when possible
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this TODO still necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The todo is necessary for now because we are getting the flattened fields.ml.blah as well as the unflattened _source.ml object. Since the fields API might change in the future to either return the values unflattened or add a way to exclude certain fields, maybe we can do a follow up PR for when the API changes.

Copy link
Copy Markdown
Contributor

@alvarezmelissa87 alvarezmelissa87 left a comment

Choose a reason for hiding this comment

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

Just left a small comment but LGTM ⚡

@qn895
Copy link
Copy Markdown
Member Author

qn895 commented Oct 5, 2020

@elasticmachine merge upstream

@qn895
Copy link
Copy Markdown
Member Author

qn895 commented Oct 5, 2020

@elasticmachine merge upstream

Copy link
Copy Markdown
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

Code LGTM, added a message about updating a comment.

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
ml 10.6MB 10.6MB +70.4KB
transform 1.2MB 1.2MB +106.0B
total +70.5KB

History

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

@qn895 qn895 merged commit ad89e6f into elastic:master Oct 5, 2020
@qn895 qn895 deleted the ml-add-runtime-fields-support branch October 5, 2020 18:01
qn895 added a commit to qn895/kibana that referenced this pull request Oct 5, 2020
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
qn895 added a commit that referenced this pull request Oct 5, 2020
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@peteharverson peteharverson mentioned this pull request Oct 7, 2020
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants