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

Support Histogram Data Type #59387

Merged

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Mar 4, 2020

Summary

Adding visualize support for the Histogram type as outlined in #52426.

Histogram data type appears in the field options for the Percentiles aggregation, as well as the Percentile Ranks aggregation.
Screen Shot 2020-03-12 at 3 51 04 PM
Screen Shot 2020-03-12 at 3 56 30 PM

Dev tools snippets for testing:

PUT histogram-test
{
  "mappings": {
    "properties": {
      "histogram-title": {
        "type": "text",
        "fields": {
          "keyword": {
            "type": "keyword"
          }
        }
      },
      "histogram-content": {
        "type": "histogram"
      }
    }
  }
}

POST histogram-test/_doc
{
  "histogram-title": "enim veniam et",
  "histogram-content": {
    "values": [
      3.7,
      4.2
    ],
    "counts": [
      227,
      141
    ]
  }
}

POST histogram-test/_doc
{
  "histogram-title": "est incididunt sunt",
  "histogram-content": {
    "values": [
      1.8,
      2.4,
      2.6,
      4.9
    ],
    "counts": [
      92,
      101,
      122,
      244
    ]
  }
}

POST histogram-test/_doc
{
  "histogram-title": "qui qui tempor",
  "histogram-content": {
    "values": [
      0.5,
      2.1,
      2.7,
      3,
      3.2,
      3.5,
      4.2,
      5
    ],
    "counts": [
      210,
      168,
      182,
      181,
      97,
      164,
      77,
      2
    ]
  }
}


POST histogram-test/_doc
{
  "histogram-title": "ullamco nisi sunt",
  "histogram-content": {
    "values": [
      1.7,
      4.5,
      4.8
    ],
    "counts": [
      74,
      146,
      141
    ]
  }
}

POST histogram-test/_doc
{
  "histogram-title": "magna eu incididunt",
  "histogram-content": {
    "values": [
      1,
      3.4,
      4.8
    ],
    "counts": [
      103,
      205,
      11
    ]
  }
}

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@ThomThomson ThomThomson added release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Vis Editor Visualization editor issues v8.0.0 v7.7.0 labels Mar 4, 2020
@ThomThomson ThomThomson self-assigned this Mar 4, 2020
@elasticmachine
Copy link
Contributor

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

@ThomThomson ThomThomson marked this pull request as ready for review March 12, 2020 20:10
@ThomThomson ThomThomson requested a review from a team as a code owner March 12, 2020 20:10
@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@ThomThomson ThomThomson force-pushed the enhancement/preAggregatedHistogram branch from 343f433 to 75e5ee1 Compare March 18, 2020 21:50
@timroes
Copy link
Contributor

timroes commented Mar 19, 2020

It seems we're still showing the histogram types fields in some aggregations, that don't support it (Top Hit and Unique Count). We should disable the field for those. I suggest a snippet like:

filterFieldTypes: Object.values(KBN_FIELD_TYPES).filter(
  type => type !== KBN_FIELD_TYPES.HISTOGRAM
),

Also we can enable the histogram field type also for the "Median" aggregation, since this is just a Kibana wrapper around the percentiles aggregation.

@ThomThomson ThomThomson force-pushed the enhancement/preAggregatedHistogram branch from 8422204 to cb26162 Compare March 19, 2020 20:09
@elastic elastic deleted a comment from kibanamachine Mar 19, 2020
Copy link
Contributor

@timroes timroes left a comment

Choose a reason for hiding this comment

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

Tested on Chrome Linux, behaves as expected. Code LGTM.

Could you potentially create one follow-up issue, that we want to have a icon in Discover for histogram fields (should be a separate PR, since we need to have Design create an icon first).

Copy link
Member

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. Tested Chrome macOS & everything seems to be working as expected!

@mattkime
Copy link
Contributor

@elasticmachine merge upstream

1 similar comment
@timroes
Copy link
Contributor

timroes commented Mar 23, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / kibana-oss-agent / Accessibility Tests.test/accessibility/apps/management·ts.Management Create Index pattern wizard

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 2 times on tracked branches: https://github.com/elastic/kibana/issues/60470

[00:00:00]       │
[00:05:25]         └-: Management
[00:05:25]           └-> "before all" hook
[00:05:25]           └-> "before all" hook
[00:05:25]             │ info [discover] Loading "mappings.json"
[00:05:25]             │ info [discover] Loading "data.json.gz"
[00:05:25]             │ info [o.e.c.m.MetaDataDeleteIndexService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_1/7A_3GxUMR7WmOIja5U4sxg] deleting index
[00:05:25]             │ info [o.e.c.m.MetaDataDeleteIndexService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_2/SC_lr5xTR_eJjcoupvz-dQ] deleting index
[00:05:25]             │ info [discover] Deleted existing index [".kibana_2",".kibana_1"]
[00:05:25]             │ info [o.e.c.m.MetaDataCreateIndexService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:05:25]             │ info [discover] Created index ".kibana"
[00:05:25]             │ debg [discover] ".kibana" settings {"index":{"number_of_replicas":"1","number_of_shards":"1"}}
[00:05:25]             │ info [discover] Indexed 2 docs into ".kibana"
[00:05:25]             │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana/9gGeUJDKSkqkUHZ_4-n02Q] update_mapping [_doc]
[00:05:25]             │ debg Migrating saved objects
[00:05:25]             │ proc [kibana]   log   [14:30:24.236] [info][savedobjects-service] Creating index .kibana_2.
[00:05:25]             │ info [o.e.c.m.MetaDataCreateIndexService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_2] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:05:25]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] updating number_of_replicas to [0] for indices [.kibana_2]
[00:05:25]             │ proc [kibana]   log   [14:30:24.300] [info][savedobjects-service] Reindexing .kibana to .kibana_1
[00:05:25]             │ info [o.e.c.m.MetaDataCreateIndexService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1], mappings [_doc]
[00:05:25]             │ info [o.e.c.r.a.AllocationService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] updating number_of_replicas to [0] for indices [.kibana_1]
[00:05:25]             │ info [o.e.t.LoggingTaskListener] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] 1929 finished with response BulkByScrollResponse[took=29ms,timed_out=false,sliceId=null,updated=0,created=2,deleted=0,batches=1,versionConflicts=0,noops=0,retries=0,throttledUntil=0s,bulk_failures=[],search_failures=[]]
[00:05:26]             │ info [o.e.c.m.MetaDataDeleteIndexService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana/9gGeUJDKSkqkUHZ_4-n02Q] deleting index
[00:05:26]             │ proc [kibana]   log   [14:30:24.645] [info][savedobjects-service] Migrating .kibana_1 saved objects to .kibana_2
[00:05:26]             │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_2/5m7MGAy6TC-gHi3eTcnE1Q] update_mapping [_doc]
[00:05:26]             │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_2/5m7MGAy6TC-gHi3eTcnE1Q] update_mapping [_doc]
[00:05:26]             │ proc [kibana]   log   [14:30:24.709] [info][savedobjects-service] Pointing alias .kibana to .kibana_2.
[00:05:26]             │ proc [kibana]   log   [14:30:24.743] [info][savedobjects-service] Finished in 509ms.
[00:05:26]             │ debg applying update to kibana config: {"accessibility:disableAnimations":true,"dateFormat:tz":"UTC"}
[00:05:26]             │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_2/5m7MGAy6TC-gHi3eTcnE1Q] update_mapping [_doc]
[00:05:27]             │ info [logstash_functional] Loading "mappings.json"
[00:05:27]             │ info [logstash_functional] Loading "data.json.gz"
[00:05:27]             │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.22"
[00:05:27]             │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.20"
[00:05:27]             │ info [logstash_functional] Skipped restore for existing index "logstash-2015.09.21"
[00:05:28]             │ debg applying update to kibana config: {"defaultIndex":"logstash-*"}
[00:05:28]             │ info [o.e.c.m.MetaDataMappingService] [kibana-ci-immutable-debian-tests-xl-1584971985121147532] [.kibana_2/5m7MGAy6TC-gHi3eTcnE1Q] update_mapping [_doc]
[00:05:29]             │ debg navigating to settings url: http://localhost:61131/app/kibana#/management
[00:05:29]             │ debg Navigate to: http://localhost:61131/app/kibana#/management
[00:05:29]             │ debg ... sleep(700) start
[00:05:29]             │ debg browser[INFO] http://localhost:61131/app/kibana?_t=1584973828330#/management 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:05:29]             │
[00:05:29]             │ debg browser[INFO] http://localhost:61131/bundles/app/kibana/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:05:30]             │ debg ... sleep(700) end
[00:05:30]             │ debg returned from get, calling refresh
[00:05:31]             │ debg browser[INFO] http://localhost:61131/bundles/plugin/data/data.plugin.js 96:139970 "INFO: 2020-03-23T14:30:29Z
[00:05:31]             │        Adding connection to http://localhost:61131/elasticsearch
[00:05:31]             │
[00:05:31]             │      "
[00:05:31]             │ERROR browser[SEVERE] http://localhost:61131/bundles/commons.bundle.js 0:1370845 TypeError: Failed to fetch
[00:05:31]             │          at Fetch._callee3$ (http://localhost:61131/bundles/commons.bundle.js:1:1398002)
[00:05:31]             │          at l (http://localhost:61131/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:338:1046209)
[00:05:31]             │          at Generator._invoke (http://localhost:61131/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:338:1045962)
[00:05:31]             │          at Generator.forEach.e.<computed> [as throw] (http://localhost:61131/bundles/kbn-ui-shared-deps/kbn-ui-shared-deps.js:338:1046566)
[00:05:31]             │          at asyncGeneratorStep (http://localhost:61131/bundles/commons.bundle.js:1:1392499)
[00:05:31]             │          at _throw (http://localhost:61131/bundles/commons.bundle.js:1:1392896)
[00:05:31]             │ debg browser[INFO] http://localhost:61131/app/kibana?_t=1584973828330#/management 341 Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution.
[00:05:31]             │
[00:05:31]             │ debg browser[INFO] http://localhost:61131/bundles/app/kibana/bootstrap.js 9:19 "^ A single error about an inline script not firing due to content security policy is expected!"
[00:05:31]             │ debg currentUrl = http://localhost:61131/app/kibana#/management
[00:05:31]             │          appUrl = http://localhost:61131/app/kibana#/management
[00:05:31]             │ debg TestSubjects.find(kibanaChrome)
[00:05:31]             │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=60000
[00:05:33]             │ debg TestSubjects.find(kibanaChrome)
[00:05:33]             │ debg Find.findByCssSelector('[data-test-subj="kibanaChrome"]') with timeout=10000
[00:05:33]             │ debg browser[INFO] http://localhost:61131/bundles/plugin/data/data.plugin.js 96:139970 "INFO: 2020-03-23T14:30:31Z
[00:05:33]             │        Adding connection to http://localhost:61131/elasticsearch
[00:05:33]             │
[00:05:33]             │      "
[00:05:33]             │ debg ... sleep(501) start
[00:05:33]             │ debg ... sleep(501) end
[00:05:33]             │ debg in navigateTo url = http://localhost:61131/app/kibana#/management?_g=()
[00:05:33]             │ debg TestSubjects.exists(statusPageContainer)
[00:05:33]             │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="statusPageContainer"]') with timeout=2500
[00:05:36]             │ debg --- retry.tryForTime error: [data-test-subj="statusPageContainer"] is not displayed
[00:05:36]           └-> main view
[00:05:36]             └-> "before each" hook: global before each
[00:05:37]             └- ✓ pass  (368ms) "Management main view"
[00:05:37]           └-> index pattern page
[00:05:37]             └-> "before each" hook: global before each
[00:05:37]             │ debg clickKibanaIndexPatterns link
[00:05:37]             │ debg TestSubjects.click(index_patterns)
[00:05:37]             │ debg Find.clickByCssSelector('[data-test-subj="index_patterns"]') with timeout=10000
[00:05:37]             │ debg Find.findByCssSelector('[data-test-subj="index_patterns"]') with timeout=10000
[00:05:37]             │ debg isGlobalLoadingIndicatorVisible
[00:05:37]             │ debg TestSubjects.exists(globalLoadingIndicator)
[00:05:37]             │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:05:37]             │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:05:39]             │ debg --- retry.tryForTime failed again with the same message...
[00:05:39]             │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:05:39]             │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:05:40]             │ debg Waiting up to 20000ms for index pattern info flyout...
[00:05:40]             │ debg TestSubjects.exists(CreateIndexPatternPrompt)
[00:05:40]             │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="CreateIndexPatternPrompt"]') with timeout=2500
[00:05:42]             │ debg --- retry.tryForTime error: [data-test-subj="CreateIndexPatternPrompt"] is not displayed
[00:05:43]             └- ✓ pass  (6.1s) "Management index pattern page"
[00:05:43]           └-> Single indexpattern view
[00:05:43]             └-> "before each" hook: global before each
[00:05:43]             │ debg Find.byXPath('//a[descendant::*[text()='logstash-*']]') with timeout=10000
[00:05:43]             └- ✓ pass  (481ms) "Management Single indexpattern view"
[00:05:43]           └-> Create Index pattern wizard
[00:05:43]             └-> "before each" hook: global before each
[00:05:43]             │ debg clickKibanaIndexPatterns link
[00:05:43]             │ debg TestSubjects.click(index_patterns)
[00:05:43]             │ debg Find.clickByCssSelector('[data-test-subj="index_patterns"]') with timeout=10000
[00:05:43]             │ debg Find.findByCssSelector('[data-test-subj="index_patterns"]') with timeout=10000
[00:05:44]             │ debg isGlobalLoadingIndicatorVisible
[00:05:44]             │ debg TestSubjects.exists(globalLoadingIndicator)
[00:05:44]             │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="globalLoadingIndicator"]') with timeout=1500
[00:05:45]             │ debg --- retry.tryForTime error: [data-test-subj="globalLoadingIndicator"] is not displayed
[00:05:46]             │ debg TestSubjects.exists(globalLoadingIndicator-hidden)
[00:05:46]             │ debg Find.existsByCssSelector('[data-test-subj="globalLoadingIndicator-hidden"]') with timeout=100000
[00:05:46]             │ debg Waiting up to 20000ms for index pattern info flyout...
[00:05:46]             │ debg TestSubjects.exists(CreateIndexPatternPrompt)
[00:05:46]             │ debg Find.existsByDisplayedByCssSelector('[data-test-subj="CreateIndexPatternPrompt"]') with timeout=2500
[00:05:48]             │ debg --- retry.tryForTime error: [data-test-subj="CreateIndexPatternPrompt"] is not displayed
[00:05:49]             │ debg TestSubjects.find(createIndexPatternButton)
[00:05:49]             │ debg Find.findByCssSelector('[data-test-subj="createIndexPatternButton"]') with timeout=10000
[00:05:59]             │ info Taking screenshot "/dev/shm/workspace/kibana/test/functional/screenshots/failure/Management Create Index pattern wizard.png"
[00:05:59]             │ info Current URL is: http://localhost:61131/app/kibana#/management/kibana/index_patterns/logstash-*?_g=()&_a=(tab:indexedFields)
[00:05:59]             │ info Saving page source to: /dev/shm/workspace/kibana/test/functional/failure_debug/html/Management Create Index pattern wizard.html
[00:05:59]             └- ✖ fail: "Management Create Index pattern wizard"
[00:05:59]             │

Stack Trace

{ TimeoutError: Waiting for element to be located By(css selector, [data-test-subj="createIndexPatternButton"])
Wait timed out after 10060ms
    at /dev/shm/workspace/kibana/node_modules/selenium-webdriver/lib/webdriver.js:841:17
    at process._tickCallback (internal/process/next_tick.js:68:7) name: 'TimeoutError', remoteStacktrace: '' }

History

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

@ThomThomson ThomThomson merged commit 05c995a into elastic:master Mar 23, 2020
ThomThomson added a commit to ThomThomson/kibana that referenced this pull request Mar 23, 2020
Added the histogram field type to Kibana, to be used in the percentiles, percentiles ranks, and median aggregations.
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 23, 2020
* master:
  [Uptime] Skip failing location test temporarily (elastic#60938)
  [ML] Disabling datafeed editing when job is running (elastic#60751)
  Adding `authc.invalidateAPIKeyAsInternalUser` (elastic#60717)
  [SIEM] Add license check to ML Rule form (elastic#60691)
  Adding `authc.grantAPIKeyAsInternalUser`  (elastic#60423)
  Support Histogram Data Type (elastic#59387)
  [Upgrade Assistant] Fix edge case where reindex op can falsely be seen as stale (elastic#60770)
  [SIEM] [Cases] Update case icons (elastic#60812)
  [TSVB] Fix percentiles band mode (elastic#60741)
gmmorris added a commit to gmmorris/kibana that referenced this pull request Mar 23, 2020
* master: (26 commits)
  [Alerting] Fixes flaky test in Alert Instances Details page (elastic#60893)
  cleanup visualizations api (elastic#59958)
  Inline timezoneProvider function, remove ui/vis/lib/timezone  (elastic#60475)
  [SIEM] Adds 'Open one signal' Cypress test (elastic#60484)
  [UA] Upgrade assistant migration meta data can become stale (elastic#60789)
  [Metrics Alerts] Remove metric field from doc count on backend (elastic#60679)
  [Uptime] Skip failing location test temporarily (elastic#60938)
  [ML] Disabling datafeed editing when job is running (elastic#60751)
  Adding `authc.invalidateAPIKeyAsInternalUser` (elastic#60717)
  [SIEM] Add license check to ML Rule form (elastic#60691)
  Adding `authc.grantAPIKeyAsInternalUser`  (elastic#60423)
  Support Histogram Data Type (elastic#59387)
  [Upgrade Assistant] Fix edge case where reindex op can falsely be seen as stale (elastic#60770)
  [SIEM] [Cases] Update case icons (elastic#60812)
  [TSVB] Fix percentiles band mode (elastic#60741)
  Fix formatter on range aggregation (elastic#58651)
  Goodbye, legacy data plugin 👋 (elastic#60449)
  [Metrics UI] Alerting for metrics explorer and inventory (elastic#58779)
  [Remote clustersadopt changes to remote info API (elastic#60795)
  Only run xpack siem cypress in PRs when there are siem changes (elastic#60661)
  ...
timroes pushed a commit that referenced this pull request Mar 24, 2020
Added the histogram field type to Kibana, to be used in the percentiles, percentiles ranks, and median aggregations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Vis Editor Visualization editor issues release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.7.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants