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] Add value count #136385

Merged
merged 16 commits into from
Jul 22, 2022
Merged

[Lens] Add value count #136385

merged 16 commits into from
Jul 22, 2022

Conversation

flash1293
Copy link
Contributor

Fixes #74910

By adding value count to the existing count function in Lens (picking another field than records).

AggConfig changes

Add value count as any other aggconfig type

Lens changes

Screenshot 2022-07-14 at 12 23 35

Screenshot 2022-07-14 at 12 23 18

If the count function is picked, it's auto-picking the records field if there is no other field available (otherwise the user would be forced to make a pick). If coming from another field based function like average, it is keeping the selected field. On the formula, no field means record field - required to adjust some bits as they used to differentiate between field and no field, now the same branches differentiate between field and optional field.

@flash1293 flash1293 added release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens backport:skip This commit does not require backporting v8.4.0 labels Jul 14, 2022
@flash1293 flash1293 marked this pull request as ready for review July 19, 2022 10:31
@flash1293 flash1293 requested review from a team as code owners July 19, 2022 10:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

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.

LGTM, this works great!
One question: Does it make sense to change the label from Value count of field to Count of field values or something like that. I find this value count of difficult to understand but it can only be me!

@flash1293
Copy link
Contributor Author

Good suggestion @stratoula , I added it to our next sync to discuss - no strong opinion from my side

@KOTungseth KOTungseth added the ui-copy Review of UI copy with docs team is recommended label Jul 21, 2022
@KOTungseth
Copy link
Contributor

178961436-61b647ca-29c6-4ab8-992e-f79a960075fc

For the definition, can we change this to:

The total number of documents. When you provide a field as the first argument, the total number of field values is counted. Use the count function for fields that have multiple values in a single document.

Examples:

To calculate the total number of documents, use count().

To calculate the number of products in all orders, use count(products.id).

To calculate the number of documents that match a specific filter, use count(kql=price > 500).

@flash1293
Copy link
Contributor Author

Thanks @KOTungseth , adjusted

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 514 516 +2

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 2413 2421 +8

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.2MB 1.2MB +1.2KB

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 4933 4935 +2

Page load bundle

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

id before after diff
data 424.2KB 426.9KB +2.7KB
Unknown metric groups

API count

id before after diff
data 3086 3094 +8

History

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

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

new value_count agg lgtm 👍

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:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure ui-copy Review of UI copy with docs team is recommended v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Allow "count of field" by supporting the value count aggregation
7 participants