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] Adds support for ES|QL in Data visualizer #174188

Merged
merged 81 commits into from Jan 31, 2024
Merged

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Jan 3, 2024

Summary

This PR adds support for ES|QL queries in Data visualizer.

Screenshot 2024-01-26 at 17 07 59 Screenshot 2024-01-26 at 17 12 39
Screen.Recording.2024-01-26.at.17.21.18.mov

Changes:

  • Add a new card from the Data visualizer main page

  • Add a link from the ML navigation

Screenshot 2024-01-08 at 18 03 50
  • Added a new button to Use ES|QL
Screenshot 2024-01-09 at 11 23 09
  • Support for keyword, text, numeric, boolean, date, and ip fields
Screenshot 2024-01-09 at 11 24 38 Screenshot 2024-01-09 at 11 25 25 Screenshot 2024-01-09 at 11 44 02 Screenshot 2024-01-10 at 12 01 42
  • Default to user's fieldFormats for fields that are dynamic generated by ES|QL, else use Data view's format

    • Default to Data view's setting (e.g. type bytes in this case for field bytes_normal_counter)
      Screenshot 2024-01-10 at 12 10 38

    • Default to user's fieldFormats formatting for dynamically generated fields (e.g. type number in this case for field avg_price)

    Screenshot 2024-01-10 at 12 01 03
  • Add a new UI control to allow users to limit analysis to 5,000 - 10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats for big data sets and avoid potential circuit breaking exceptions.

  • Break overall stats request into smaller parallel requests (which prevent time out or payload too big due by too many fields), at 10 requests at a time

  • Break field stats for individual fields into more efficient batches (which prevent time out or payload too big due by too many fields), at 10 requests at at ime

  • Improve error handling by propagating up the error AND the ES|QL request in both the UI and the developer's console (for better debugging)

  • Improve error handling in field stats rows: If one field, or a group of fields, say 'keyword' fields fail to fetch for some reasons, it will show error for that field but not affect all other fields.

Screenshot 2024-01-26 at 16 04 28
  • Add deep linking in the top search bar
Screenshot 2024-01-26 at 16 56 49
  • More robust support for keyword fields with geo data
Screenshot 2024-01-26 at 16 55 01

Todos:

  • Add earliest/latest for date time fields -> Current blocker: escape special characters in esql variable names
  • Fix formatting of numbers for dynamic query, where we don't know the formatting based on the data view
  • Fix date time 'Update' not updating until Refresh is clicked
  • Better optimization to not fetch distribution & expanded row content for pages that are not visible

Good to have:

  • Investigate bringing back the +/- filter buttons (either by modifying the ES|QL query directly or by adding separate DSL filters?)

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@qn895 qn895 added :ml Feature:File and Index Data Viz ML file and index data visualizer v8.13.0 labels Jan 3, 2024
@qn895 qn895 self-assigned this Jan 3, 2024
@peteharverson peteharverson changed the title [ML] Add support for ESQL in Data visualizer [ML] Add support for ES|QL in Data visualizer Jan 4, 2024
@qn895 qn895 requested a review from darnautov January 25, 2024 17:35
@qn895
Copy link
Member Author

qn895 commented Jan 26, 2024

I've updated the PR to improve several things:

  • Add a new UI control to allow users to limit analysis to 5,000 - 10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats for big data sets and avoid potential circuit breaking exceptions.
  • Break overall stats request into smaller parallel requests (which prevent time out or payload too big due by too many fields), at 10 requests at a time
  • Break field stats for individual fields into more efficient batches (which prevent time out or payload too big due by too many fields), at 10 requests at at ime
  • Improve error handling by propagating up the error AND the ES|QL request in both the UI and the developer's console (for better debugging)
  • Improve error handling in field stats rows: If one field, or a group of fields, say 'keyword' fields fail to fetch for some reasons, it will show error for that field but not affect all other fields.
Screenshot 2024-01-26 at 16 04 28
  • Add deep linking in the top search bar
Screenshot 2024-01-26 at 16 56 49
  • More robust support for Geo fields
Screenshot 2024-01-26 at 16 55 01

Copy link
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 latest changes locally and on the cloud deployment. The 'limit' control is a great addition. The other optimizations are also working well - I didn't actually see any timeout warnings on the test cases I was using before.

Added one question on the limit setting here - #174188 (comment).

Copy link
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 latest changes and LGTM

@qn895
Copy link
Member Author

qn895 commented Jan 31, 2024

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

kibana-ci commented Jan 31, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dataVisualizer 585 603 +18
ml 1894 1895 +1
total +19

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/ml-cancellable-search - 8 +8

Async chunks

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

id before after diff
aiops 397.8KB 397.8KB +29.0B
dataVisualizer 617.6KB 645.3KB +27.7KB
ml 3.6MB 3.6MB +3.1KB
transform 402.5KB 402.5KB +31.0B
total +30.8KB

Canvas Sharable Runtime

The Canvas "shareable runtime" is an bundle produced to enable running Canvas workpads outside of Kibana. This bundle is included in third-party webpages that embed canvas and therefor should be as slim as possible.

id before after diff
module count - 5901 +5901
total size - 6.5MB +6.5MB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 384.4KB 384.6KB +215.0B
dataVisualizer 23.0KB 23.2KB +148.0B
ml 78.3KB 78.4KB +73.0B
total +436.0B
Unknown metric groups

API count

id before after diff
@kbn/ml-cancellable-search - 8 +8

ESLint disabled in files

id before after diff
dataVisualizer 0 1 +1

ESLint disabled line counts

id before after diff
dataVisualizer 51 59 +8

Total ESLint disabled count

id before after diff
dataVisualizer 51 60 +9

History

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

cc @qn895

@qn895 qn895 merged commit 53c3907 into elastic:main Jan 31, 2024
39 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 31, 2024
WafaaNasr pushed a commit to WafaaNasr/kibana that referenced this pull request Feb 5, 2024
## Summary

This PR adds support for ES|QL queries in Data visualizer.

<img width="1695" alt="Screenshot 2024-01-26 at 17 07 59"
src="https://github.com/elastic/kibana/assets/43350163/8a54b859-60d6-4c47-b3dd-e5f3ed43b6b0">

<img width="1695" alt="Screenshot 2024-01-26 at 17 12 39"
src="https://github.com/elastic/kibana/assets/43350163/32fd08e4-7f3b-43e6-81a7-7ec4e777bac0">


https://github.com/elastic/kibana/assets/43350163/a3f540e9-461d-4ebc-bd69-de4ffa2bc554



### Changes:

- Add a new card from the Data visualizer main page

- Add a link from the ML navigation

<img width="1717" alt="Screenshot 2024-01-08 at 18 03 50"
src="https://github.com/elastic/kibana/assets/43350163/832f7890-4ce6-44c1-ab87-cde01f4bf1c0">

- Added a new button to Use ES|QL

<img width="1714" alt="Screenshot 2024-01-09 at 11 23 09"
src="https://github.com/elastic/kibana/assets/43350163/a38a9360-6691-4f3b-a824-8481ab543250">


- Support for **keyword**, **text**, **numeric**, **boolean**, **date**,
and **ip** fields

<img width="1714" alt="Screenshot 2024-01-09 at 11 24 38"
src="https://github.com/elastic/kibana/assets/43350163/b122ee5c-1500-4e2b-9434-e64b0b6ea3be">

<img width="1441" alt="Screenshot 2024-01-09 at 11 25 25"
src="https://github.com/elastic/kibana/assets/43350163/eb35ee78-8a34-467e-84da-2026b01fcda1">

<img width="969" alt="Screenshot 2024-01-09 at 11 44 02"
src="https://github.com/elastic/kibana/assets/43350163/d0f9947d-2b2c-4c14-89ba-9fc5d0a2bf64">

<img width="981" alt="Screenshot 2024-01-10 at 12 01 42"
src="https://github.com/elastic/kibana/assets/43350163/aa5a8d44-7447-41fc-a544-d1b626bf8bce">

- Default to user's fieldFormats for fields that are dynamic generated
by ES|QL, else use Data view's format

- Default to Data view's setting (e.g. type `bytes` in this case for
field `bytes_normal_counter`)
<img width="1037" alt="Screenshot 2024-01-10 at 12 10 38"
src="https://github.com/elastic/kibana/assets/43350163/9fb7e31c-f397-4209-a463-e1a43fe27ffd">

- Default to user's fieldFormats formatting for dynamically generated
fields (e.g. type `number` in this case for field `avg_price`)
<img width="1283" alt="Screenshot 2024-01-10 at 12 01 03"
src="https://github.com/elastic/kibana/assets/43350163/acc25358-50bb-4237-9476-86067ef0badf">

- Add a new UI control to allow users to limit analysis to 5,000 -
10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats
for big data sets and avoid potential circuit breaking exceptions.
- Break overall stats request into smaller parallel requests (which
prevent time out or payload too big due by too many fields), at 10
requests at a time
- Break field stats for individual fields into more efficient batches
(which prevent time out or payload too big due by too many fields), at
10 requests at at ime
- Improve error handling by propagating up the error AND the ES|QL
request in both the UI and the developer's console (for better
debugging)
- Improve error handling in field stats rows: If one field, or a group
of fields, say 'keyword' fields fail to fetch for some reasons, it will
show error for that field but not affect all other fields.


<img width="1690" alt="Screenshot 2024-01-26 at 16 04 28"
src="https://github.com/elastic/kibana/assets/43350163/6e240e12-76b4-42d6-b3be-c05342d76df9">

- Add deep linking in the top search bar

<img width="1185" alt="Screenshot 2024-01-26 at 16 56 49"
src="https://github.com/elastic/kibana/assets/43350163/4f24df68-edc5-41c5-b2ed-d6150ba1e20b">

- More robust support for keyword fields with geo data

<img width="1438" alt="Screenshot 2024-01-26 at 16 55 01"
src="https://github.com/elastic/kibana/assets/43350163/3b97925b-ca28-4952-8082-8d3242e3cb3f">




### Todos:
- [x] Add earliest/latest for date time fields -> Current blocker:
escape special characters in esql variable names
- [x] Fix formatting of numbers for dynamic query, where we don't know
the formatting based on the data view
- [x] Fix date time 'Update' not updating until Refresh is clicked
- [x] Better optimization to not fetch distribution & expanded row
content for pages that are not visible


### Good to have:
- [ ] Investigate bringing back the +/- filter buttons (either by
modifying the ES|QL query directly or by adding separate DSL filters?)

------------

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
WafaaNasr pushed a commit to WafaaNasr/kibana that referenced this pull request Feb 6, 2024
## Summary

This PR adds support for ES|QL queries in Data visualizer.

<img width="1695" alt="Screenshot 2024-01-26 at 17 07 59"
src="https://github.com/elastic/kibana/assets/43350163/8a54b859-60d6-4c47-b3dd-e5f3ed43b6b0">

<img width="1695" alt="Screenshot 2024-01-26 at 17 12 39"
src="https://github.com/elastic/kibana/assets/43350163/32fd08e4-7f3b-43e6-81a7-7ec4e777bac0">


https://github.com/elastic/kibana/assets/43350163/a3f540e9-461d-4ebc-bd69-de4ffa2bc554



### Changes:

- Add a new card from the Data visualizer main page

- Add a link from the ML navigation

<img width="1717" alt="Screenshot 2024-01-08 at 18 03 50"
src="https://github.com/elastic/kibana/assets/43350163/832f7890-4ce6-44c1-ab87-cde01f4bf1c0">

- Added a new button to Use ES|QL

<img width="1714" alt="Screenshot 2024-01-09 at 11 23 09"
src="https://github.com/elastic/kibana/assets/43350163/a38a9360-6691-4f3b-a824-8481ab543250">


- Support for **keyword**, **text**, **numeric**, **boolean**, **date**,
and **ip** fields

<img width="1714" alt="Screenshot 2024-01-09 at 11 24 38"
src="https://github.com/elastic/kibana/assets/43350163/b122ee5c-1500-4e2b-9434-e64b0b6ea3be">

<img width="1441" alt="Screenshot 2024-01-09 at 11 25 25"
src="https://github.com/elastic/kibana/assets/43350163/eb35ee78-8a34-467e-84da-2026b01fcda1">

<img width="969" alt="Screenshot 2024-01-09 at 11 44 02"
src="https://github.com/elastic/kibana/assets/43350163/d0f9947d-2b2c-4c14-89ba-9fc5d0a2bf64">

<img width="981" alt="Screenshot 2024-01-10 at 12 01 42"
src="https://github.com/elastic/kibana/assets/43350163/aa5a8d44-7447-41fc-a544-d1b626bf8bce">

- Default to user's fieldFormats for fields that are dynamic generated
by ES|QL, else use Data view's format

- Default to Data view's setting (e.g. type `bytes` in this case for
field `bytes_normal_counter`)
<img width="1037" alt="Screenshot 2024-01-10 at 12 10 38"
src="https://github.com/elastic/kibana/assets/43350163/9fb7e31c-f397-4209-a463-e1a43fe27ffd">

- Default to user's fieldFormats formatting for dynamically generated
fields (e.g. type `number` in this case for field `avg_price`)
<img width="1283" alt="Screenshot 2024-01-10 at 12 01 03"
src="https://github.com/elastic/kibana/assets/43350163/acc25358-50bb-4237-9476-86067ef0badf">

- Add a new UI control to allow users to limit analysis to 5,000 -
10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats
for big data sets and avoid potential circuit breaking exceptions.
- Break overall stats request into smaller parallel requests (which
prevent time out or payload too big due by too many fields), at 10
requests at a time
- Break field stats for individual fields into more efficient batches
(which prevent time out or payload too big due by too many fields), at
10 requests at at ime
- Improve error handling by propagating up the error AND the ES|QL
request in both the UI and the developer's console (for better
debugging)
- Improve error handling in field stats rows: If one field, or a group
of fields, say 'keyword' fields fail to fetch for some reasons, it will
show error for that field but not affect all other fields.


<img width="1690" alt="Screenshot 2024-01-26 at 16 04 28"
src="https://github.com/elastic/kibana/assets/43350163/6e240e12-76b4-42d6-b3be-c05342d76df9">

- Add deep linking in the top search bar

<img width="1185" alt="Screenshot 2024-01-26 at 16 56 49"
src="https://github.com/elastic/kibana/assets/43350163/4f24df68-edc5-41c5-b2ed-d6150ba1e20b">

- More robust support for keyword fields with geo data

<img width="1438" alt="Screenshot 2024-01-26 at 16 55 01"
src="https://github.com/elastic/kibana/assets/43350163/3b97925b-ca28-4952-8082-8d3242e3cb3f">




### Todos:
- [x] Add earliest/latest for date time fields -> Current blocker:
escape special characters in esql variable names
- [x] Fix formatting of numbers for dynamic query, where we don't know
the formatting based on the data view
- [x] Fix date time 'Update' not updating until Refresh is clicked
- [x] Better optimization to not fetch distribution & expanded row
content for pages that are not visible


### Good to have:
- [ ] Investigate bringing back the +/- filter buttons (either by
modifying the ES|QL query directly or by adding separate DSL filters?)

------------

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@peteharverson peteharverson changed the title [ML] Add support for ES|QL in Data visualizer [ML] Adds support for ES|QL in Data visualizer Feb 14, 2024
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

This PR adds support for ES|QL queries in Data visualizer.

<img width="1695" alt="Screenshot 2024-01-26 at 17 07 59"
src="https://github.com/elastic/kibana/assets/43350163/8a54b859-60d6-4c47-b3dd-e5f3ed43b6b0">

<img width="1695" alt="Screenshot 2024-01-26 at 17 12 39"
src="https://github.com/elastic/kibana/assets/43350163/32fd08e4-7f3b-43e6-81a7-7ec4e777bac0">


https://github.com/elastic/kibana/assets/43350163/a3f540e9-461d-4ebc-bd69-de4ffa2bc554



### Changes:

- Add a new card from the Data visualizer main page

- Add a link from the ML navigation

<img width="1717" alt="Screenshot 2024-01-08 at 18 03 50"
src="https://github.com/elastic/kibana/assets/43350163/832f7890-4ce6-44c1-ab87-cde01f4bf1c0">

- Added a new button to Use ES|QL

<img width="1714" alt="Screenshot 2024-01-09 at 11 23 09"
src="https://github.com/elastic/kibana/assets/43350163/a38a9360-6691-4f3b-a824-8481ab543250">


- Support for **keyword**, **text**, **numeric**, **boolean**, **date**,
and **ip** fields

<img width="1714" alt="Screenshot 2024-01-09 at 11 24 38"
src="https://github.com/elastic/kibana/assets/43350163/b122ee5c-1500-4e2b-9434-e64b0b6ea3be">

<img width="1441" alt="Screenshot 2024-01-09 at 11 25 25"
src="https://github.com/elastic/kibana/assets/43350163/eb35ee78-8a34-467e-84da-2026b01fcda1">

<img width="969" alt="Screenshot 2024-01-09 at 11 44 02"
src="https://github.com/elastic/kibana/assets/43350163/d0f9947d-2b2c-4c14-89ba-9fc5d0a2bf64">

<img width="981" alt="Screenshot 2024-01-10 at 12 01 42"
src="https://github.com/elastic/kibana/assets/43350163/aa5a8d44-7447-41fc-a544-d1b626bf8bce">

- Default to user's fieldFormats for fields that are dynamic generated
by ES|QL, else use Data view's format

- Default to Data view's setting (e.g. type `bytes` in this case for
field `bytes_normal_counter`)
<img width="1037" alt="Screenshot 2024-01-10 at 12 10 38"
src="https://github.com/elastic/kibana/assets/43350163/9fb7e31c-f397-4209-a463-e1a43fe27ffd">

- Default to user's fieldFormats formatting for dynamically generated
fields (e.g. type `number` in this case for field `avg_price`)
<img width="1283" alt="Screenshot 2024-01-10 at 12 01 03"
src="https://github.com/elastic/kibana/assets/43350163/acc25358-50bb-4237-9476-86067ef0badf">

- Add a new UI control to allow users to limit analysis to 5,000 -
10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats
for big data sets and avoid potential circuit breaking exceptions.
- Break overall stats request into smaller parallel requests (which
prevent time out or payload too big due by too many fields), at 10
requests at a time
- Break field stats for individual fields into more efficient batches
(which prevent time out or payload too big due by too many fields), at
10 requests at at ime
- Improve error handling by propagating up the error AND the ES|QL
request in both the UI and the developer's console (for better
debugging)
- Improve error handling in field stats rows: If one field, or a group
of fields, say 'keyword' fields fail to fetch for some reasons, it will
show error for that field but not affect all other fields.


<img width="1690" alt="Screenshot 2024-01-26 at 16 04 28"
src="https://github.com/elastic/kibana/assets/43350163/6e240e12-76b4-42d6-b3be-c05342d76df9">

- Add deep linking in the top search bar

<img width="1185" alt="Screenshot 2024-01-26 at 16 56 49"
src="https://github.com/elastic/kibana/assets/43350163/4f24df68-edc5-41c5-b2ed-d6150ba1e20b">

- More robust support for keyword fields with geo data

<img width="1438" alt="Screenshot 2024-01-26 at 16 55 01"
src="https://github.com/elastic/kibana/assets/43350163/3b97925b-ca28-4952-8082-8d3242e3cb3f">




### Todos:
- [x] Add earliest/latest for date time fields -> Current blocker:
escape special characters in esql variable names
- [x] Fix formatting of numbers for dynamic query, where we don't know
the formatting based on the data view
- [x] Fix date time 'Update' not updating until Refresh is clicked
- [x] Better optimization to not fetch distribution & expanded row
content for pages that are not visible


### Good to have:
- [ ] Investigate bringing back the +/- filter buttons (either by
modifying the ES|QL query directly or by adding separate DSL filters?)

------------

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CoenWarmer pushed a commit to CoenWarmer/kibana that referenced this pull request Feb 15, 2024
## Summary

This PR adds support for ES|QL queries in Data visualizer.

<img width="1695" alt="Screenshot 2024-01-26 at 17 07 59"
src="https://github.com/elastic/kibana/assets/43350163/8a54b859-60d6-4c47-b3dd-e5f3ed43b6b0">

<img width="1695" alt="Screenshot 2024-01-26 at 17 12 39"
src="https://github.com/elastic/kibana/assets/43350163/32fd08e4-7f3b-43e6-81a7-7ec4e777bac0">


https://github.com/elastic/kibana/assets/43350163/a3f540e9-461d-4ebc-bd69-de4ffa2bc554



### Changes:

- Add a new card from the Data visualizer main page

- Add a link from the ML navigation

<img width="1717" alt="Screenshot 2024-01-08 at 18 03 50"
src="https://github.com/elastic/kibana/assets/43350163/832f7890-4ce6-44c1-ab87-cde01f4bf1c0">

- Added a new button to Use ES|QL

<img width="1714" alt="Screenshot 2024-01-09 at 11 23 09"
src="https://github.com/elastic/kibana/assets/43350163/a38a9360-6691-4f3b-a824-8481ab543250">


- Support for **keyword**, **text**, **numeric**, **boolean**, **date**,
and **ip** fields

<img width="1714" alt="Screenshot 2024-01-09 at 11 24 38"
src="https://github.com/elastic/kibana/assets/43350163/b122ee5c-1500-4e2b-9434-e64b0b6ea3be">

<img width="1441" alt="Screenshot 2024-01-09 at 11 25 25"
src="https://github.com/elastic/kibana/assets/43350163/eb35ee78-8a34-467e-84da-2026b01fcda1">

<img width="969" alt="Screenshot 2024-01-09 at 11 44 02"
src="https://github.com/elastic/kibana/assets/43350163/d0f9947d-2b2c-4c14-89ba-9fc5d0a2bf64">

<img width="981" alt="Screenshot 2024-01-10 at 12 01 42"
src="https://github.com/elastic/kibana/assets/43350163/aa5a8d44-7447-41fc-a544-d1b626bf8bce">

- Default to user's fieldFormats for fields that are dynamic generated
by ES|QL, else use Data view's format

- Default to Data view's setting (e.g. type `bytes` in this case for
field `bytes_normal_counter`)
<img width="1037" alt="Screenshot 2024-01-10 at 12 10 38"
src="https://github.com/elastic/kibana/assets/43350163/9fb7e31c-f397-4209-a463-e1a43fe27ffd">

- Default to user's fieldFormats formatting for dynamically generated
fields (e.g. type `number` in this case for field `avg_price`)
<img width="1283" alt="Screenshot 2024-01-10 at 12 01 03"
src="https://github.com/elastic/kibana/assets/43350163/acc25358-50bb-4237-9476-86067ef0badf">

- Add a new UI control to allow users to limit analysis to 5,000 -
10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats
for big data sets and avoid potential circuit breaking exceptions.
- Break overall stats request into smaller parallel requests (which
prevent time out or payload too big due by too many fields), at 10
requests at a time
- Break field stats for individual fields into more efficient batches
(which prevent time out or payload too big due by too many fields), at
10 requests at at ime
- Improve error handling by propagating up the error AND the ES|QL
request in both the UI and the developer's console (for better
debugging)
- Improve error handling in field stats rows: If one field, or a group
of fields, say 'keyword' fields fail to fetch for some reasons, it will
show error for that field but not affect all other fields.


<img width="1690" alt="Screenshot 2024-01-26 at 16 04 28"
src="https://github.com/elastic/kibana/assets/43350163/6e240e12-76b4-42d6-b3be-c05342d76df9">

- Add deep linking in the top search bar

<img width="1185" alt="Screenshot 2024-01-26 at 16 56 49"
src="https://github.com/elastic/kibana/assets/43350163/4f24df68-edc5-41c5-b2ed-d6150ba1e20b">

- More robust support for keyword fields with geo data

<img width="1438" alt="Screenshot 2024-01-26 at 16 55 01"
src="https://github.com/elastic/kibana/assets/43350163/3b97925b-ca28-4952-8082-8d3242e3cb3f">




### Todos:
- [x] Add earliest/latest for date time fields -> Current blocker:
escape special characters in esql variable names
- [x] Fix formatting of numbers for dynamic query, where we don't know
the formatting based on the data view
- [x] Fix date time 'Update' not updating until Refresh is clicked
- [x] Better optimization to not fetch distribution & expanded row
content for pages that are not visible


### Good to have:
- [ ] Investigate bringing back the +/- filter buttons (either by
modifying the ES|QL query directly or by adding separate DSL filters?)

------------

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Mar 4, 2024
## Summary

This PR adds support for ES|QL queries in Data visualizer.

<img width="1695" alt="Screenshot 2024-01-26 at 17 07 59"
src="https://github.com/elastic/kibana/assets/43350163/8a54b859-60d6-4c47-b3dd-e5f3ed43b6b0">

<img width="1695" alt="Screenshot 2024-01-26 at 17 12 39"
src="https://github.com/elastic/kibana/assets/43350163/32fd08e4-7f3b-43e6-81a7-7ec4e777bac0">


https://github.com/elastic/kibana/assets/43350163/a3f540e9-461d-4ebc-bd69-de4ffa2bc554



### Changes:

- Add a new card from the Data visualizer main page

- Add a link from the ML navigation

<img width="1717" alt="Screenshot 2024-01-08 at 18 03 50"
src="https://github.com/elastic/kibana/assets/43350163/832f7890-4ce6-44c1-ab87-cde01f4bf1c0">

- Added a new button to Use ES|QL

<img width="1714" alt="Screenshot 2024-01-09 at 11 23 09"
src="https://github.com/elastic/kibana/assets/43350163/a38a9360-6691-4f3b-a824-8481ab543250">


- Support for **keyword**, **text**, **numeric**, **boolean**, **date**,
and **ip** fields

<img width="1714" alt="Screenshot 2024-01-09 at 11 24 38"
src="https://github.com/elastic/kibana/assets/43350163/b122ee5c-1500-4e2b-9434-e64b0b6ea3be">

<img width="1441" alt="Screenshot 2024-01-09 at 11 25 25"
src="https://github.com/elastic/kibana/assets/43350163/eb35ee78-8a34-467e-84da-2026b01fcda1">

<img width="969" alt="Screenshot 2024-01-09 at 11 44 02"
src="https://github.com/elastic/kibana/assets/43350163/d0f9947d-2b2c-4c14-89ba-9fc5d0a2bf64">

<img width="981" alt="Screenshot 2024-01-10 at 12 01 42"
src="https://github.com/elastic/kibana/assets/43350163/aa5a8d44-7447-41fc-a544-d1b626bf8bce">

- Default to user's fieldFormats for fields that are dynamic generated
by ES|QL, else use Data view's format

- Default to Data view's setting (e.g. type `bytes` in this case for
field `bytes_normal_counter`)
<img width="1037" alt="Screenshot 2024-01-10 at 12 10 38"
src="https://github.com/elastic/kibana/assets/43350163/9fb7e31c-f397-4209-a463-e1a43fe27ffd">

- Default to user's fieldFormats formatting for dynamically generated
fields (e.g. type `number` in this case for field `avg_price`)
<img width="1283" alt="Screenshot 2024-01-10 at 12 01 03"
src="https://github.com/elastic/kibana/assets/43350163/acc25358-50bb-4237-9476-86067ef0badf">

- Add a new UI control to allow users to limit analysis to 5,000 -
10,000 - 100,000 - 1,000,000, rows. This speeds up fetching of the stats
for big data sets and avoid potential circuit breaking exceptions.
- Break overall stats request into smaller parallel requests (which
prevent time out or payload too big due by too many fields), at 10
requests at a time
- Break field stats for individual fields into more efficient batches
(which prevent time out or payload too big due by too many fields), at
10 requests at at ime
- Improve error handling by propagating up the error AND the ES|QL
request in both the UI and the developer's console (for better
debugging)
- Improve error handling in field stats rows: If one field, or a group
of fields, say 'keyword' fields fail to fetch for some reasons, it will
show error for that field but not affect all other fields.


<img width="1690" alt="Screenshot 2024-01-26 at 16 04 28"
src="https://github.com/elastic/kibana/assets/43350163/6e240e12-76b4-42d6-b3be-c05342d76df9">

- Add deep linking in the top search bar

<img width="1185" alt="Screenshot 2024-01-26 at 16 56 49"
src="https://github.com/elastic/kibana/assets/43350163/4f24df68-edc5-41c5-b2ed-d6150ba1e20b">

- More robust support for keyword fields with geo data

<img width="1438" alt="Screenshot 2024-01-26 at 16 55 01"
src="https://github.com/elastic/kibana/assets/43350163/3b97925b-ca28-4952-8082-8d3242e3cb3f">




### Todos:
- [x] Add earliest/latest for date time fields -> Current blocker:
escape special characters in esql variable names
- [x] Fix formatting of numbers for dynamic query, where we don't know
the formatting based on the data view
- [x] Fix date time 'Update' not updating until Refresh is clicked
- [x] Better optimization to not fetch distribution & expanded row
content for pages that are not visible


### Good to have:
- [ ] Investigate bringing back the +/- filter buttons (either by
modifying the ES|QL query directly or by adding separate DSL filters?)

------------

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)


### Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to
identify risks that should be tested prior to the change/feature
release.

When forming the risk matrix, consider some of the following examples
and how they may potentially impact the change:

| Risk | Probability | Severity | Mitigation/Notes |

|---------------------------|-------------|----------|-------------------------|
| Multiple Spaces&mdash;unexpected behavior in non-default Kibana Space.
| Low | High | Integration tests will verify that all features are still
supported in non-default Kibana Space and when user switches between
spaces. |
| Multiple nodes&mdash;Elasticsearch polling might have race conditions
when multiple Kibana nodes are polling for the same tasks. | High | Low
| Tasks are idempotent, so executing them multiple times will not result
in logical error, but will degrade performance. To test for this case we
add plenty of unit tests around this logic and document manual testing
procedure. |
| Code should gracefully handle cases when feature X or plugin Y are
disabled. | Medium | High | Unit tests will verify that any feature flag
or plugin combination still results in our service operational. |
| [See more potential risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) |


### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@qn895 qn895 deleted the ml-esql-dv branch March 25, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:build-serverless-image ci:cloud-deploy Create or update a Cloud deployment Feature:File and Index Data Viz ML file and index data visualizer :ml release_note:feature Makes this part of the condensed release notes v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants