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 #94918

Closed
flash1293 opened this issue Mar 18, 2021 · 7 comments · Fixed by #116632
Closed

[Lens] Expose Elasticsearch accuracy warnings to the user #94918

flash1293 opened this issue Mar 18, 2021 · 7 comments · Fixed by #116632
Assignees
Labels
enhancement New value added to drive a business result Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects

Comments

@flash1293
Copy link
Contributor

Per #87115 (comment)

Kibana does not show warnings when sort by ascending results from elasticsearch include the unbounded error warning: "doc_count_error_upper_bound" : -1,

To give a concrete example how this could easily happen:

Given time-based indices, terms are not distributed evenly across the indices. Today for example "Tanya Roberts" is mentioned widely in news articles because she was reported as dead but then it was revealed she was alive. A very popular topic in today's news index. However the 80s Bond girl is very rarely mentioned, if at all, in older indices. So when you do a "rarest terms" aggregation across multiple shards the index for today would not return Tanya Roberts in the list of rarest values because she is seen as far from rare. However, another older index might have one mention of her and return that as being rare. So the final merged results for Tanya are 1 - entirely missing the large count from today's index.

In these cases we take special care to supply a doc_count_error_upper_bound to let client apps know how far out the doc counts can be. When we return -1 it means we could be majorly wrong - as in the Tanya Roberts blind spot. Lens and regular visualisations do not offer any warning when this is the case:

Big_error_dash_-_Elastic_and_Bad_default_sort_order_in_Lens_·_Issue__87115_·_elastic_kibana

The warning in the response going unreported is this one:

Big_error_no_warnings__non_Lens__-_Elastic

The data/mapping to recreate this error is here. I use shard-routing to recreate the uneven spread of names typical of time-based indices:

DELETE test
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" }

GET test/_search
{
  "size":0,
  "aggs":{
    "terms":{
      "terms":{
        "field": "name",
        "order": {
          "_count": "asc"
        }
      }
    }
  }
}

When working with descending count sort orders the results are much less prone to inaccuracy and are more bounded error margins (most shards agree on Trump, Obama etc being the most popular) but ascending sort order inaccuracies can be wild.

@flash1293 flash1293 added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens labels Mar 18, 2021
@flash1293 flash1293 added this to Long-term goals in Lens via automation Mar 18, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@markharwood
Copy link
Contributor

Thanks for opening this @flash1293
It's worth noting that doc_count_error_upper_bound values of zero are fully accurate.
When we know we are inaccurate we often are capable of knowing the worst case scenario of how far out the doc counts might be and will return this as a > 0 number.
A -1 value in the response is the extreme case where we can't even begin to estimate how inaccurate the results are.

Wording which is comprehensible to lay users is likely to be tricky but the low-level guidance for devs might be of some help

@wylieconlon
Copy link
Contributor

Is this a warning, error, or information? I don't think we have an existing pattern to fit this into, so we'll need some thinking about how this would look and behave. Some questions:

  • Where does the accuracy info belong in the Lens editor?
  • What about the Lens embeddable?
  • How does accuracy display in relation to a scrollable data table?

I would really like to avoid the previous patterns that are used in Visualize: semi-transparent warnings that obscure the chart, and toast messages which stack up on the screen when you load a dashboard. Can we come up with a more user-friendly way to display this?

@flash1293
Copy link
Contributor Author

Not a fan of semi-transparent warning boxes either. We do have one pattern that's related (at least for the editor):
Screenshot 2021-03-23 at 09 16 27

Not sure whether we need to show it in the embeddable as well. cc @MichaelMarcialis do you have an idea how to show warnings in a Lens panel on a dashboard for cases where we can render a chart, but the data might not be fully correct?

@markharwood
Copy link
Contributor

markharwood commented Mar 23, 2021

There's a fair amount of stuff out there about visualizing uncertainty.

It's worth considering what we can offer users to resolve the inaccuracies. For example, a button to retrieve the exact numbers for the displayed terms. Typically we mix discovery (finding out the top/lowest N terms) and reporting (showing numerical values connected to these terms) in one request. Fixing the reporting is easy - just send another query with an include clause of the discovered terms and all data nodes will focus on filling in all the details for this select group. However, fixing the discovery part (correctly identifying the global top N terms from millions in the first place) can be much harder which could involve
a) Increasing shard_size or
b) Making multiple requests using terms pagination or composite aggs or
c) Reindexing using transforms API.

While we might not be able to solve the discovery inaccuracies, the reporting inaccuracies are easily fixable.

@MichaelMarcialis
Copy link
Contributor

Not sure whether we need to show it in the embeddable as well. cc @MichaelMarcialis do you have an idea how to show warnings in a Lens panel on a dashboard for cases where we can render a chart, but the data might not be fully correct?

@flash1293: I also like the idea of utilizing the warning button and popover in the editor for this. As for providing a similar warning popover for Lens panels in Dashboard, a few possibilities come to mind (though I'm not 100% familiar with what is or isn't technically possible in dashboards). The most immediate thought would be to include an alert icon button (possibly with a count of warnings) that triggers this popover either the bottom left of the panel (as a sibling to the show/hide legend button) or possibly next to the panel header (if greater prominence is desired).

Let me know if this is something you need/want mocked up, or if you prefer to just make a POC yourself in code.

@shahzad31 shahzad31 moved this from Long-term goals to 7.13 in Lens Mar 26, 2021
@flash1293 flash1293 moved this from 7.13 to Long-term goals in Lens Apr 1, 2021
@ghudgins
Copy link

ghudgins commented Jul 1, 2021

consider performance warning cases when designing warnings

@flash1293 flash1293 moved this from Long-term goals to 7.15 in Lens Jul 8, 2021
@stratoula stratoula moved this from 7.15 to 7.16 in Lens Jul 15, 2021
@stratoula stratoula moved this from 7.16 to 8.1 in Lens Aug 5, 2021
@alexwizp alexwizp self-assigned this Oct 26, 2021
alexwizp added a commit to alexwizp/kibana that referenced this issue Nov 1, 2021
alexwizp added a commit to alexwizp/kibana that referenced this issue Nov 1, 2021
Lens automation moved this from 8.1 to Done Nov 11, 2021
alexwizp added a commit that referenced this issue Nov 11, 2021
* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: #94918

* fix comments

* update text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
claudiopro pushed a commit to claudiopro/kibana that referenced this issue Nov 11, 2021
…6632)

* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: elastic#94918

* fix comments

* update text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
fkanout pushed a commit to fkanout/kibana that referenced this issue Nov 17, 2021
…6632)

* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: elastic#94918

* fix comments

* update text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
dmlemeshko pushed a commit that referenced this issue Nov 29, 2021
* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: #94918

* fix comments

* update text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
roeehub pushed a commit to build-security/kibana that referenced this issue Dec 16, 2021
…6632)

* [Lens] Expose Elasticsearch accuracy warnings to the user

Closes: elastic#94918

* fix comments

* update text

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Lens Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
No open projects
Lens
  
Done
Development

Successfully merging a pull request may close this issue.

7 participants