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] Expose Elasticsearch accuracy warnings to the user #116632

Merged
merged 9 commits into from
Nov 11, 2021

Conversation

alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Oct 28, 2021

Closes: #94918

Summary

Lens should show warnings when sort by ascending results from elasticsearch include the unbounded error warning: "doc_count_error_upper_bound" : -1 or greater than 0

Screens

image

Testing notes:

  1. Go to DevTools and execute the following 2 commands
PUT test
{
  "settings": {
    "number_of_shards": 4
  },
  "mappings": {
    "properties": {
      "name":{
        "type":"keyword"
      }
    }
  }
}
POST _bulk
{ "index" : { "_index" : "test"} }
{ "name" : "jim" }
{ "index" : { "_index" : "test"} }
{ "name" : "bob" }
{ "index" : { "_index" : "test"} }
{ "name" : "sue" }
{ "index" : { "_index" : "test"} }
{ "name" : "jane" }
{ "index" : { "_index" : "test", "routing": "earlier"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "tanya roberts" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z1" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z2" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z3" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z4" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z5" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z6" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z7" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z8" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z9" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z10" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z11" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z12" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z13" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z14" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z15" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z16" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z17" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z18" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z19" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z20" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z21" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z22" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z23" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z24" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z25" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z26" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z27" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z28" }
{ "index" : { "_index" : "test", "routing": "today"} }
{ "name" : "z29" }
  1. Create new Data View based on created test index
  2. Go to Lens and create new Hit Map visualization based on test Data View

Expected result: precision error warning message should be shown

@elastic elastic deleted a comment from kibanamachine Nov 1, 2021
@alexwizp alexwizp changed the title WIP [Lens] Expose Elasticsearch accuracy warnings to the user [Lens] Expose Elasticsearch accuracy warnings to the user Nov 1, 2021
@alexwizp alexwizp self-assigned this Nov 1, 2021
@alexwizp alexwizp added Feature:Lens v8.1.0 Team:Visualizations Visualization editors, elastic-charts and infrastructure release_note:enhancement labels Nov 1, 2021
@alexwizp alexwizp marked this pull request as ready for review November 1, 2021 13:29
@alexwizp alexwizp requested review from a team as code owners November 1, 2021 13:29
@elasticmachine
Copy link
Contributor

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

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

some smaller nits.

Could we add a Unit test for this to the terms aggconfig?

@ghudgins about the wording of the error message - not sure how we should do this. Does talking about aggregations here makes sense (as it’s not a Lens concept)? Should we make it more general? Also, Maybe we should mention a possible workaround with increasing the size. Maybe linking to a paragraph in the doc to be able to better explain what’s going on?

@botelastic botelastic bot added the Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) label Nov 1, 2021
@alexwizp
Copy link
Contributor Author

alexwizp commented Nov 2, 2021

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

alexwizp commented Nov 3, 2021

@elasticmachine merge upstream

@ghudgins
Copy link

ghudgins commented Nov 8, 2021

Sorry for the delay. I think we should focus on what the user can do and not necessarily an administrator. Maybe something like

Top values for this visualization may be approximate due to how the data is indexed. Try increasing the number of Top values or use Filters instead of Top values for precise results. To learn more about this limit, visit the documentation.

@MichaelMarcialis
Copy link
Contributor

+1 to what @ghudgins says about focusing the message on what the user can do.

Top values for this visualization may be approximate due to how the data is indexed. Try increasing the number of Top values or use Filters instead of Top values for precise results. To learn more about this limit, visit the documentation.

Regarding this messaging, would it be possible and/or desirable to also have reference to top values and filters function as links that automatically open the appropriate configuration flyout for the user (as a sort of shortcut)? For example, clicking a top values link could open that configuration and auto-focus the top value number field. Thoughts?

@ghudgins
Copy link

ghudgins commented Nov 8, 2021

would it be possible and/or desirable to also have reference to top values and filters function as links that automatically open the appropriate configuration flyout for the user (as a sort of shortcut)

@MichaelMarcialis nice idea, I don't think that can hurt (as long as it's simple to do technically). I love "errors" that have "actions" on them

@flash1293
Copy link
Contributor

Let's go with just the warning for the first version - this kind of action is pretty complex to implement into our current structure. It makes a lot of sense to provide it though, I will open a separate issue for it.

# Conflicts:
#	test/interpreter_functional/snapshots/baseline/combined_test3.json
#	test/interpreter_functional/snapshots/baseline/final_output_test.json
#	test/interpreter_functional/snapshots/baseline/metric_all_data.json
#	test/interpreter_functional/snapshots/baseline/metric_empty_data.json
#	test/interpreter_functional/snapshots/baseline/metric_multi_metric_data.json
#	test/interpreter_functional/snapshots/baseline/metric_percentage_mode.json
#	test/interpreter_functional/snapshots/baseline/metric_single_metric_data.json
#	test/interpreter_functional/snapshots/baseline/partial_test_2.json
#	test/interpreter_functional/snapshots/baseline/step_output_test3.json
#	test/interpreter_functional/snapshots/session/combined_test3.json
#	test/interpreter_functional/snapshots/session/final_output_test.json
#	test/interpreter_functional/snapshots/session/metric_all_data.json
#	test/interpreter_functional/snapshots/session/metric_empty_data.json
#	test/interpreter_functional/snapshots/session/metric_multi_metric_data.json
#	test/interpreter_functional/snapshots/session/metric_percentage_mode.json
#	test/interpreter_functional/snapshots/session/metric_single_metric_data.json
#	test/interpreter_functional/snapshots/session/partial_test_2.json
#	test/interpreter_functional/snapshots/session/step_output_test3.json
@alexwizp
Copy link
Contributor Author

alexwizp commented Nov 9, 2021

message was updated

image

@flash1293
Copy link
Contributor

That's great @alexwizp - one small nit about the message: Could the leading "Top values" be replaced with the label of the column? Just to make it easier for the user to find it in case there is more than one top values in the current chart.

@alexwizp
Copy link
Contributor Author

alexwizp commented Nov 9, 2021

image

@alexwizp alexwizp requested a review from dej611 November 9, 2021 12:43
@alexwizp
Copy link
Contributor Author

alexwizp commented Nov 9, 2021

@elastic/kibana-app-services please 👀

@alexwizp
Copy link
Contributor Author

@elastic/kibana-app-services please review

warningMessages.push(
<FormattedMessage
id="xpack.lens.indexPattern.precisionErrorWarning"
defaultMessage="{docCount} values for a terms aggregation may be approximate. As a result, any sub-aggregations on the terms aggregation may also be approximate."
Copy link
Member

Choose a reason for hiding this comment

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

nit: how do we know here that it was a terms aggregation that may be approximate ? it seems that hasPrecissionError could theoretically exist on any aggregation ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ppisljar no, hasPrecissionError is calculated for terms only. For other kinds of aggregations, hasPrecisionError method is undefined.

Copy link
Member

@ppisljar ppisljar 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

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.

Tested locally with FF and Safari 👍

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@alexwizp alexwizp added the backport:skip This commit does not require backporting label Nov 11, 2021
@alexwizp alexwizp enabled auto-merge (squash) November 11, 2021 10:13
@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Test Failures

  • [job] [logs] Default CI Group #18 / apis uptime uptime REST endpoints with generated data certs api when data is present retrieves expected cert data

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
data 500 501 +1

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 2848 2855 +7

Async chunks

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

id before after diff
lens 954.5KB 955.7KB +1.2KB

Page load bundle

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

id before after diff
core 268.1KB 268.2KB +111.0B
data 430.9KB 431.4KB +599.0B
total +710.0B
Unknown metric groups

API count

id before after diff
data 3238 3245 +7

History

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

cc @alexwizp

@alexwizp alexwizp merged commit 4c1e629 into elastic:main Nov 11, 2021
claudiopro pushed a commit to claudiopro/kibana that referenced this pull request Nov 11, 2021
…6632)

* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: elastic#94918

* fix comments

* update text

Co-authored-by: Kibana Machine <[email protected]>
fkanout pushed a commit to fkanout/kibana that referenced this pull request Nov 17, 2021
…6632)

* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: elastic#94918

* fix comments

* update text

Co-authored-by: Kibana Machine <[email protected]>
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: #94918

* fix comments

* update text

Co-authored-by: Kibana Machine <[email protected]>
roeehub pushed a commit to build-security/kibana that referenced this pull request Dec 16, 2021
…6632)

* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: elastic#94918

* fix comments

* update text

Co-authored-by: Kibana Machine <[email protected]>
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) Feature:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Expose Elasticsearch accuracy warnings to the user
9 participants