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

[Maps] term join metrics with same aggregation and field have name collision #63287

Closed
nreese opened this issue Apr 10, 2020 · 2 comments · Fixed by #63324
Closed

[Maps] term join metrics with same aggregation and field have name collision #63287

nreese opened this issue Apr 10, 2020 · 2 comments · Fixed by #63324
Labels
bug Fixes for quality problems that affect the customer experience [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation

Comments

@nreese
Copy link
Contributor

nreese commented Apr 10, 2020

https://discuss.elastic.co/t/multiple-term-join-in-elastic-maps/227550

Create a ES Documents source from kibana_sample_data_logs data set. Set scaling to top terms and split on machine.os. In the screen shot below, there are 2 configured terms join that use a where clause to create different results. One is looking for the avg bytes when bytes is greater than 10000 and the other is looking for avg bytes when bytes is less then 10000. Notice how both avg bytes metrics are the same. They should have different values.

Screen Shot 2020-04-10 at 2 12 47 PM

This is caused because the metrics from the separate terms joins are not name spaced. So both store their values in the same feature property key __kbnjoin__avg_of_bytes_groupby_kibana_sample_data_logs.machine.os.keyword. Metric key is created here - https://github.com/elastic/kibana/blob/7.7/x-pack/legacy/plugins/maps/public/layers/sources/es_term_source.js#L66

Saved object joins configuration

"joins": [
      {
        "leftField": "machine.os",
        "right": {
          "id": "9055b4aa-136a-4b6d-90ab-9f94ccfe5eb5",
          "indexPatternTitle": "kibana_sample_data_logs",
          "term": "machine.os.keyword",
          "metrics": [
            {
              "type": "avg",
              "field": "bytes"
            }
          ],
          "whereQuery": {
            "query": "bytes > 10000",
            "language": "kuery"
          },
          "indexPatternRefName": "layer_1_join_0_index_pattern"
        }
      },
      {
        "leftField": "machine.os",
        "right": {
          "id": "9a7f4e71-9500-4512-82f1-b7eaee3d87ff",
          "indexPatternTitle": "kibana_sample_data_logs",
          "term": "machine.os.keyword",
          "whereQuery": {
            "query": "bytes < 10000",
            "language": "kuery"
          },
          "metrics": [
            {
              "type": "avg",
              "field": "bytes"
            }
          ],
          "indexPatternRefName": "layer_1_join_1_index_pattern"
        }
      }
    ]
@nreese nreese added bug Fixes for quality problems that affect the customer experience [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation labels Apr 10, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

@nreese
Copy link
Contributor Author

nreese commented Apr 10, 2020

The tricky part to fixing this will be preserving existing saved objects. Styling links to the join field by the aggKey so if the aggKey changes, then we will have to migrate any styling properties using the agg key.

For example, below is the fill color styling descriptor for the saved object configuration. __kbnjoin__avg_of_bytes_groupby_kibana_sample_data_logs.machine.os.keyword would need to be updated if the aggKey includes the join id.

"style": {
      "properties": {
        "fillColor": {
          "type": "DYNAMIC",
          "options": {
            "color": "Blues",
            "colorCategory": "palette_0",
            "field": {
              "name": "__kbnjoin__avg_of_bytes_groupby_kibana_sample_data_logs.machine.os.keyword",
              "origin": "join"
            },
            "fieldMetaOptions": {
              "isEnabled": true,
              "sigma": 3
            },
            "type": "ORDINAL"
          }
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants