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

lens esql generation #196049

Open
wants to merge 102 commits into
base: main
Choose a base branch
from
Open

lens esql generation #196049

wants to merge 102 commits into from

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Oct 14, 2024

Summary

updates lens so it uses ESQL when requesting data from elasticsearch rather than DSL when that is possible.

nothing should change for the user, everything should work exactly as before

but when going to inspector you will be able to see that in some cases we will send out ESQL request.

the feature is only enabled when the lens.enable_esql feature flag is enabled.

at the moment this covers very few cases, but rather builds the necessary infrastructure so we can keep improving this over time:

  • user has to be in UTC timezone
  • user needs to use set of lens operations that are supported

how to test:

  1. put this in your kibana.dev.yaml:
feature_flags.overrides:
  lens.enable_esql: true
  1. go to advanced settings and set timezone to UTC
  2. go to lens, configure a chart (for example a metric chart showing average of products.price
  3. go to inspector -> requests and you can see that we sent out ESQL query
  4. visually nothing should change

todo:

  • make sure CI is green when the feature flag is enabled

@ppisljar ppisljar added Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting labels Nov 12, 2024
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

I have started testing this. I find the transitions on date histogram a bit weird. How do the rest feel about it?

@markov00 markov00 self-requested a review January 14, 2025 08:36
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

This is very close, found 2 more bugs concerning the date histogram

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Another one related to filtering

Copy link
Contributor

Choose a reason for hiding this comment

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

Clicking on a metric with count(*) creates a wrong filter

image

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed in c9f594c

Copy link
Member

Choose a reason for hiding this comment

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

fixed now, the click is not enabled if the metric is showing count of records

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be enabled here though right?

image

I am clicking the metric but I dont get a filter

Copy link
Member

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Everything fine for me, thanks Peter for this.

Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

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

I've left some code reviews.
Not major issues, but it would be nice to have them addressed. If not, please create a follow up issue to track them.

return;
}
const column = table.columns[columnIndex];
const { indexPattern, sourceField, operationType, interval } = table.columns[columnIndex].meta
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be nice to have a type guard here

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Jan 22, 2025
@stratoula
Copy link
Contributor

I see this error in the kibana server Peter

image

@stratoula
Copy link
Contributor

stratoula commented Jan 22, 2025

I see an error in the console when I drop Records "field"

image

yes something goes wrong with the xAxis label
image

@stratoula
Copy link
Contributor

ok console error gone and x-axis working as expected. This is the only thing not working correctly #196049 (comment)

@elasticmachine
Copy link
Contributor

elasticmachine commented Jan 22, 2025

💔 Build Failed

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL handles an event when operation type is a date histogram
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL handles an event when operation type is a date histogram
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL handles an event when operation type is histogram
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL handles an event when operation type is histogram
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL handles an event when operation type is not date histogram
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL handles an event when operation type is not date histogram
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL ignores event when sourceField is missing
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL ignores event when sourceField is missing
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL ignores event when value for rows is not provided
  • [job] [logs] Jest Tests #8 / createFiltersFromClickEvent createFilterESQL ignores event when value for rows is not provided

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 522 537 +15
lens 1754 1755 +1
total +16

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
data 2598 2602 +4
expressions 1769 1771 +2
total +6

Async chunks

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

id before after diff
lens 1.6MB 1.6MB +6.6KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
data 25 26 +1

Page load bundle

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

id before after diff
data 419.5KB 423.0KB +3.5KB
expressions 101.4KB 101.7KB +287.0B
total +3.8KB
Unknown metric groups

API count

id before after diff
data 3213 3218 +5
expressions 2241 2243 +2
total +7

History

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 Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants