From 800acdd3233742031f63865dc6a704a9730dada9 Mon Sep 17 00:00:00 2001 From: ouyangmingyuan Date: Tue, 24 Nov 2015 20:44:27 +0800 Subject: [PATCH 1/2] changes 11-24 --- bin/kibana | 25 --- bin/kibana.bat | 25 --- config/kibana.yml | 3 + package.json | 2 + src/cli/plugin/plugin.js | 12 +- .../public/discover/controllers/discover.js | 34 +++- src/plugins/kibana/public/discover/index.html | 16 +- .../discover/partials/alert_search.html | 147 ++++++++++++++++++ src/server/KbnServer.js | 1 + src/server/auth/index.js | 43 +++++ src/server/auth/lib/authStrategyMap.js | 1 + src/server/config/schema.js | 2 +- 12 files changed, 252 insertions(+), 59 deletions(-) delete mode 100755 bin/kibana delete mode 100644 bin/kibana.bat create mode 100644 src/plugins/kibana/public/discover/partials/alert_search.html create mode 100755 src/server/auth/index.js create mode 100755 src/server/auth/lib/authStrategyMap.js diff --git a/bin/kibana b/bin/kibana deleted file mode 100755 index 5f2a124b801e88..00000000000000 --- a/bin/kibana +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -SCRIPT=$0 - -# SCRIPT may be an arbitrarily deep series of symlinks. Loop until we have the concrete path. -while [ -h "$SCRIPT" ] ; do - ls=$(ls -ld "$SCRIPT") - # Drop everything prior to -> - link=$(expr "$ls" : '.*-> \(.*\)$') - if expr "$link" : '/.*' > /dev/null; then - SCRIPT="$link" - else - SCRIPT=$(dirname "$SCRIPT")/"$link" - fi -done - -DIR="$(dirname "${SCRIPT}")/.." -NODE="${DIR}/node/bin/node" -test -x "$NODE" || NODE=$(which node) -if [ ! -x "$NODE" ]; then - echo "unable to find usable node.js executable." - exit 1 -fi - -exec "${NODE}" "${DIR}/src/cli" ${@} - diff --git a/bin/kibana.bat b/bin/kibana.bat deleted file mode 100644 index 53a0df663b9e65..00000000000000 --- a/bin/kibana.bat +++ /dev/null @@ -1,25 +0,0 @@ -@echo off - -SETLOCAL - -set SCRIPT_DIR=%~dp0 -for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI - -set NODE=%DIR%\node\node.exe -for /f "delims=" %%i in ('WHERE node') do set SYS_NODE=%%i - -If Not Exist "%NODE%" ( - IF Exist "%SYS_NODE%" ( - set NODE=%SYS_NODE% - ) else ( - Echo unable to find usable node.js executable. - Exit /B 1 - ) -) - -TITLE Kibana Server -"%NODE%" "%DIR%\src\cli" %* - -:finally - -ENDLOCAL diff --git a/config/kibana.yml b/config/kibana.yml index cd5569bbbd8b67..024319eb99f492 100644 --- a/config/kibana.yml +++ b/config/kibana.yml @@ -70,3 +70,6 @@ # Set this to true to log all events, including system usage information and all requests. # logging.verbose: false + +auth.enabled: true +auth.strategy: esProxy diff --git a/package.json b/package.json index 2fbb80d4044742..13d800edc53ef7 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,7 @@ "babel-core": "5.8.23", "babel-loader": "5.3.2", "babel-runtime": "5.8.20", + "bcrypt": "^0.8.5", "bluebird": "2.9.34", "boom": "2.8.0", "bootstrap": "3.3.5", @@ -154,6 +155,7 @@ "gruntify-eslint": "1.0.1", "html-entities": "1.1.3", "husky": "0.8.1", + "hapi-auth-basic": "^3.0.0", "intern": "3.0.1", "istanbul-instrumenter-loader": "0.1.3", "karma": "0.13.9", diff --git a/src/cli/plugin/plugin.js b/src/cli/plugin/plugin.js index ac5a7996784b89..a8a49e445dc6f5 100644 --- a/src/cli/plugin/plugin.js +++ b/src/cli/plugin/plugin.js @@ -12,7 +12,7 @@ module.exports = function (program) { try { settings = settingParser(command).parse(); } catch (ex) { - //The logger has not yet been initialized. + // The logger has not yet been initialized. console.error(ex.message); process.exit(64); // eslint-disable-line no-process-exit } @@ -55,15 +55,15 @@ module.exports = function (program) { Common examples: -i username/sample attempts to download the latest version from the following urls: - https://download.elastic.co/username/sample/sample-latest.tar.gz - https://github.com/username/sample/archive/master.tar.gz + https:// download.elastic.co/username/sample/sample-latest.tar.gz + https:// github.com/username/sample/archive/master.tar.gz -i username/sample/v1.1.1 attempts to download version v1.1.1 from the following urls: - https://download.elastic.co/username/sample/sample-v1.1.1.tar.gz - https://github.com/username/sample/archive/v1.1.1.tar.gz + https:// download.elastic.co/username/sample/sample-v1.1.1.tar.gz + https:// github.com/username/sample/archive/v1.1.1.tar.gz - -i sample -u http://www.example.com/other_name.tar.gz + -i sample -u http:// www.example.com/other_name.tar.gz attempts to download from the specified url, and installs the plugin found at that url as "sample" ` diff --git a/src/plugins/kibana/public/discover/controllers/discover.js b/src/plugins/kibana/public/discover/controllers/discover.js index f144362cd7a8e9..7bda7d5920fa26 100644 --- a/src/plugins/kibana/public/discover/controllers/discover.js +++ b/src/plugins/kibana/public/discover/controllers/discover.js @@ -90,6 +90,7 @@ define(function (require) { // config panel templates $scope.configTemplate = new ConfigTemplate({ + alert: require('plugins/kibana/discover/partials/alert_search.html'), load: require('plugins/kibana/discover/partials/load_search.html'), save: require('plugins/kibana/discover/partials/save_search.html') }); @@ -285,6 +286,37 @@ define(function (require) { }) .catch(notify.error); }; + + + $scope.opts.saveAlert = function () { + + var name=$("#name").val(); + var query=$("#query").val(); + var sendTo=$("#sendTo").val(); + var timeRange=$("#timeRange").val(); + var triggerCondition=$("#triggerCondition").val(); + var triggerNumber=$("#triggerNumber").val(); + + var enabled=$("#enabled").is(':checked'); + var jsonData = '{"name":"'+name+'","query":"'+query+'","timeRange":"'+timeRange+'","enabled":"'+enabled+'",' + +'"sendTo":"'+sendTo+'","triggerNumber":"'+triggerNumber+'","triggerCondition":"'+triggerCondition+'"}'; + + jQuery.ajax({ + url : "http://localhost:9000/alert/", + type : "POST", + dataType : "json", + contentType : "application/json", + data : jsonData, + cache : false, + success : function(data) { + alert("保存成功"); + }, + complete : function() { + //$("#long").dialog("close"); + } + }) + + }; $scope.opts.fetch = $scope.fetch = function () { // ignore requests to fetch before the app inits @@ -421,7 +453,7 @@ define(function (require) { $scope.resetQuery = function () { kbnUrl.change('/discover/{{id}}', { id: $route.current.params.id }); }; - + $scope.newQuery = function () { kbnUrl.change('/discover'); }; diff --git a/src/plugins/kibana/public/discover/index.html b/src/plugins/kibana/public/discover/index.html index 9111b3ba53aab6..87b4a8b37f96fd 100644 --- a/src/plugins/kibana/public/discover/index.html +++ b/src/plugins/kibana/public/discover/index.html @@ -9,7 +9,7 @@ input-focus kbn-typeahead-input ng-model="state.query" - placeholder="Search..." + placeholder="Query String" aria-label="Search input" type="text" class="form-control"> @@ -23,6 +23,17 @@ + + + diff --git a/src/plugins/kibana/public/discover/partials/alert_search.html b/src/plugins/kibana/public/discover/partials/alert_search.html new file mode 100644 index 00000000000000..0ab4c4dc90db90 --- /dev/null +++ b/src/plugins/kibana/public/discover/partials/alert_search.html @@ -0,0 +1,147 @@ +
+
+
+
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+ + +
+ +
+
+ + +
+
+
+ +
+ + +
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+ + +
+ +
+
+ +
+ +
+
+ +
+
+
+
+ + + +
+
+ +
+
+
+
+
+
diff --git a/src/server/KbnServer.js b/src/server/KbnServer.js index 525c92473bcfca..73d18ea2a50303 100644 --- a/src/server/KbnServer.js +++ b/src/server/KbnServer.js @@ -35,6 +35,7 @@ module.exports = class KbnServer { // finally, initialize the plugins require('./plugins/initialize'), + // require('./auth'), () => { if (this.config.get('server.autoListen')) { diff --git a/src/server/auth/index.js b/src/server/auth/index.js new file mode 100755 index 00000000000000..a0c24a37b10d40 --- /dev/null +++ b/src/server/auth/index.js @@ -0,0 +1,43 @@ +let _ = require('lodash'); +let Bcrypt = require('bcrypt'); +let Hapi = require('hapi'); +let Basic = require('hapi-auth-basic'); + +module.exports = (kbnServer, server, config) => { + + var users = { + john: { + username: 'john', + password: '$2a$10$iqJSHD.BGr0E2IxQwYgJmeP3NvhPrXAeLSaGCj6IR/XU5QtjVu5Tm', // 'secret' + name: 'John Doe', + id: '2133d32a' + } + }; + + var validate = function (request, username, password, callback) { + var user = users[username]; + if (!user) { + return callback(null, false); + } + + Bcrypt.compare(password, user.password, function (err, isValid) { + callback(err, isValid, { id: user.id, name: user.name }); + }); + }; + + server.register(Basic, function (err) { + + server.auth.strategy('simple', 'basic', { validateFunc: validate }); + server.route({ + method: 'GET', + path: '/login', + config: { + auth: 'simple', + handler: function (request, reply) { + return reply.redirect('./app/kibana'); + } + } + }); + + }); +}; \ No newline at end of file diff --git a/src/server/auth/lib/authStrategyMap.js b/src/server/auth/lib/authStrategyMap.js new file mode 100755 index 00000000000000..e67ddfa7ab9379 --- /dev/null +++ b/src/server/auth/lib/authStrategyMap.js @@ -0,0 +1 @@ +module.exports = new Map(); \ No newline at end of file diff --git a/src/server/config/schema.js b/src/server/config/schema.js index 69b50dc7aaf8b7..5e0d2c951ed534 100644 --- a/src/server/config/schema.js +++ b/src/server/config/schema.js @@ -78,7 +78,7 @@ module.exports = Joi.object({ }).default(), optimize: Joi.object({ - enabled: Joi.boolean().default(true), + enabled: Joi.boolean().default(false), bundleFilter: Joi.string().default('!tests'), bundleDir: Joi.string().default(fromRoot('optimize/bundles')), viewCaching: Joi.boolean().default(Joi.ref('$prod')), From 9f424c9a0692f6b78cfd6d4758c689be88555cf4 Mon Sep 17 00:00:00 2001 From: ouyangmingyuan Date: Wed, 25 Nov 2015 19:53:40 +0800 Subject: [PATCH 2/2] 11_25 --- bin/fixtures/agg_resp/date_histogram.js | 252 ++ bin/fixtures/agg_resp/geohash_grid.js | 83 + bin/fixtures/agg_resp/range.js | 37 + bin/fixtures/config_upgrade_from_4.0.0.json | 25 + ..._upgrade_from_4.0.0_to_4.0.1-snapshot.json | 35 + .../config_upgrade_from_4.0.0_to_4.0.1.json | 35 + bin/fixtures/fake_chart_events.js | 22 + bin/fixtures/fake_hierarchical_data.js | 228 + bin/fixtures/fake_row.js | 22 + bin/fixtures/field_mapping.js | 62 + bin/fixtures/filter_skeleton.js | 7 + bin/fixtures/hits.js | 24 + bin/fixtures/logstash_fields.js | 37 + bin/fixtures/mapping_with_dupes.js | 40 + bin/fixtures/mock_courier.js | 17 + bin/fixtures/mock_state.js | 18 + bin/fixtures/real_hits.js | 227 + bin/fixtures/require_from.js | 0 bin/fixtures/search_response.js | 18 + bin/fixtures/stubbed_doc_source_response.js | 22 + .../stubbed_logstash_index_pattern.js | 24 + bin/fixtures/stubbed_search_source.js | 36 + bin/fixtures/tilemap_map.js | 21 + bin/fixtures/vislib/_vis_fixture.js | 33 + .../mock_data/date_histogram/_columns.js | 264 ++ .../vislib/mock_data/date_histogram/_rows.js | 1645 ++++++++ .../mock_data/date_histogram/_series.js | 150 + .../mock_data/date_histogram/_series_neg.js | 150 + .../date_histogram/_series_pos_neg.js | 150 + .../date_histogram/_stacked_series.js | 1483 +++++++ .../vislib/mock_data/filters/_columns.js | 106 + .../vislib/mock_data/filters/_rows.js | 106 + .../vislib/mock_data/filters/_series.js | 40 + .../vislib/mock_data/geohash/_columns.js | 3744 +++++++++++++++++ .../vislib/mock_data/geohash/_geo_json.js | 1846 ++++++++ .../vislib/mock_data/geohash/_rows.js | 3667 ++++++++++++++++ .../vislib/mock_data/histogram/_columns.js | 346 ++ .../vislib/mock_data/histogram/_rows.js | 187 + .../vislib/mock_data/histogram/_series.js | 103 + .../vislib/mock_data/histogram/_slices.js | 309 ++ .../mock_data/not_enough_data/_one_point.js | 32 + .../vislib/mock_data/range/_columns.js | 59 + bin/fixtures/vislib/mock_data/range/_rows.js | 84 + .../vislib/mock_data/range/_series.js | 36 + .../mock_data/significant_terms/_columns.js | 232 + .../mock_data/significant_terms/_rows.js | 232 + .../mock_data/significant_terms/_series.js | 48 + .../vislib/mock_data/stacked/_stacked.js | 1572 +++++++ .../vislib/mock_data/terms/_columns.js | 142 + bin/fixtures/vislib/mock_data/terms/_rows.js | 97 + .../vislib/mock_data/terms/_series.js | 48 + bin/optimize/BaseOptimizer.js | 174 + bin/optimize/FsOptimizer.js | 28 + bin/optimize/babelOptions.build.js | 16 + bin/optimize/babelOptions.js | 11 + bin/optimize/index.js | 55 + bin/optimize/lazy/LazyOptimizer.js | 117 + bin/optimize/lazy/LazyServer.js | 22 + bin/optimize/lazy/WeirdControlFlow.js | 58 + bin/optimize/lazy/lazy.js | 35 + bin/optimize/lazy/optmzrRole.js | 41 + bin/optimize/lazy/proxyRole.js | 45 + bin/testUtils/noDigestPromises.js | 38 + bin/testUtils/simulateKeys.js | 106 + bin/testUtils/stubIndexPattern.js | 46 + src/plugins/esProxyAuth/index.js | 45 + src/plugins/esProxyAuth/package.json | 4 + src/plugins/htpasswdAuth/index.js | 59 + src/plugins/htpasswdAuth/package.json | 4 + src/server/auth/index.js | 243 +- tasks/build/index.js_bak | 31 + 71 files changed, 19372 insertions(+), 9 deletions(-) create mode 100644 bin/fixtures/agg_resp/date_histogram.js create mode 100644 bin/fixtures/agg_resp/geohash_grid.js create mode 100644 bin/fixtures/agg_resp/range.js create mode 100644 bin/fixtures/config_upgrade_from_4.0.0.json create mode 100644 bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json create mode 100644 bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json create mode 100644 bin/fixtures/fake_chart_events.js create mode 100644 bin/fixtures/fake_hierarchical_data.js create mode 100644 bin/fixtures/fake_row.js create mode 100644 bin/fixtures/field_mapping.js create mode 100644 bin/fixtures/filter_skeleton.js create mode 100644 bin/fixtures/hits.js create mode 100644 bin/fixtures/logstash_fields.js create mode 100644 bin/fixtures/mapping_with_dupes.js create mode 100644 bin/fixtures/mock_courier.js create mode 100644 bin/fixtures/mock_state.js create mode 100644 bin/fixtures/real_hits.js create mode 100644 bin/fixtures/require_from.js create mode 100644 bin/fixtures/search_response.js create mode 100644 bin/fixtures/stubbed_doc_source_response.js create mode 100644 bin/fixtures/stubbed_logstash_index_pattern.js create mode 100644 bin/fixtures/stubbed_search_source.js create mode 100644 bin/fixtures/tilemap_map.js create mode 100644 bin/fixtures/vislib/_vis_fixture.js create mode 100644 bin/fixtures/vislib/mock_data/date_histogram/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/date_histogram/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/date_histogram/_series.js create mode 100644 bin/fixtures/vislib/mock_data/date_histogram/_series_neg.js create mode 100644 bin/fixtures/vislib/mock_data/date_histogram/_series_pos_neg.js create mode 100644 bin/fixtures/vislib/mock_data/date_histogram/_stacked_series.js create mode 100644 bin/fixtures/vislib/mock_data/filters/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/filters/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/filters/_series.js create mode 100644 bin/fixtures/vislib/mock_data/geohash/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/geohash/_geo_json.js create mode 100644 bin/fixtures/vislib/mock_data/geohash/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/histogram/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/histogram/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/histogram/_series.js create mode 100644 bin/fixtures/vislib/mock_data/histogram/_slices.js create mode 100644 bin/fixtures/vislib/mock_data/not_enough_data/_one_point.js create mode 100644 bin/fixtures/vislib/mock_data/range/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/range/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/range/_series.js create mode 100644 bin/fixtures/vislib/mock_data/significant_terms/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/significant_terms/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/significant_terms/_series.js create mode 100644 bin/fixtures/vislib/mock_data/stacked/_stacked.js create mode 100644 bin/fixtures/vislib/mock_data/terms/_columns.js create mode 100644 bin/fixtures/vislib/mock_data/terms/_rows.js create mode 100644 bin/fixtures/vislib/mock_data/terms/_series.js create mode 100644 bin/optimize/BaseOptimizer.js create mode 100644 bin/optimize/FsOptimizer.js create mode 100644 bin/optimize/babelOptions.build.js create mode 100644 bin/optimize/babelOptions.js create mode 100644 bin/optimize/index.js create mode 100644 bin/optimize/lazy/LazyOptimizer.js create mode 100644 bin/optimize/lazy/LazyServer.js create mode 100644 bin/optimize/lazy/WeirdControlFlow.js create mode 100644 bin/optimize/lazy/lazy.js create mode 100644 bin/optimize/lazy/optmzrRole.js create mode 100644 bin/optimize/lazy/proxyRole.js create mode 100644 bin/testUtils/noDigestPromises.js create mode 100644 bin/testUtils/simulateKeys.js create mode 100644 bin/testUtils/stubIndexPattern.js create mode 100755 src/plugins/esProxyAuth/index.js create mode 100755 src/plugins/esProxyAuth/package.json create mode 100755 src/plugins/htpasswdAuth/index.js create mode 100755 src/plugins/htpasswdAuth/package.json create mode 100644 tasks/build/index.js_bak diff --git a/bin/fixtures/agg_resp/date_histogram.js b/bin/fixtures/agg_resp/date_histogram.js new file mode 100644 index 00000000000000..3c66a87dd4bec1 --- /dev/null +++ b/bin/fixtures/agg_resp/date_histogram.js @@ -0,0 +1,252 @@ +define(function () { + return { + 'took': 35, + 'timed_out': false, + '_shards': { + 'total': 2, + 'successful': 2, + 'failed': 0 + }, + 'hits': { + 'total': 32899, + 'max_score': 0, + 'hits': [] + }, + 'aggregations': { + '1': { + 'buckets': [ + { + 'key_as_string': '2015-01-30T01:00:00.000Z', + 'key': 1422579600000, + 'doc_count': 18 + }, + { + 'key_as_string': '2015-01-30T02:00:00.000Z', + 'key': 1422583200000, + 'doc_count': 68 + }, + { + 'key_as_string': '2015-01-30T03:00:00.000Z', + 'key': 1422586800000, + 'doc_count': 146 + }, + { + 'key_as_string': '2015-01-30T04:00:00.000Z', + 'key': 1422590400000, + 'doc_count': 149 + }, + { + 'key_as_string': '2015-01-30T05:00:00.000Z', + 'key': 1422594000000, + 'doc_count': 363 + }, + { + 'key_as_string': '2015-01-30T06:00:00.000Z', + 'key': 1422597600000, + 'doc_count': 555 + }, + { + 'key_as_string': '2015-01-30T07:00:00.000Z', + 'key': 1422601200000, + 'doc_count': 878 + }, + { + 'key_as_string': '2015-01-30T08:00:00.000Z', + 'key': 1422604800000, + 'doc_count': 1133 + }, + { + 'key_as_string': '2015-01-30T09:00:00.000Z', + 'key': 1422608400000, + 'doc_count': 1438 + }, + { + 'key_as_string': '2015-01-30T10:00:00.000Z', + 'key': 1422612000000, + 'doc_count': 1719 + }, + { + 'key_as_string': '2015-01-30T11:00:00.000Z', + 'key': 1422615600000, + 'doc_count': 1813 + }, + { + 'key_as_string': '2015-01-30T12:00:00.000Z', + 'key': 1422619200000, + 'doc_count': 1790 + }, + { + 'key_as_string': '2015-01-30T13:00:00.000Z', + 'key': 1422622800000, + 'doc_count': 1582 + }, + { + 'key_as_string': '2015-01-30T14:00:00.000Z', + 'key': 1422626400000, + 'doc_count': 1439 + }, + { + 'key_as_string': '2015-01-30T15:00:00.000Z', + 'key': 1422630000000, + 'doc_count': 1154 + }, + { + 'key_as_string': '2015-01-30T16:00:00.000Z', + 'key': 1422633600000, + 'doc_count': 847 + }, + { + 'key_as_string': '2015-01-30T17:00:00.000Z', + 'key': 1422637200000, + 'doc_count': 588 + }, + { + 'key_as_string': '2015-01-30T18:00:00.000Z', + 'key': 1422640800000, + 'doc_count': 374 + }, + { + 'key_as_string': '2015-01-30T19:00:00.000Z', + 'key': 1422644400000, + 'doc_count': 152 + }, + { + 'key_as_string': '2015-01-30T20:00:00.000Z', + 'key': 1422648000000, + 'doc_count': 140 + }, + { + 'key_as_string': '2015-01-30T21:00:00.000Z', + 'key': 1422651600000, + 'doc_count': 73 + }, + { + 'key_as_string': '2015-01-30T22:00:00.000Z', + 'key': 1422655200000, + 'doc_count': 28 + }, + { + 'key_as_string': '2015-01-30T23:00:00.000Z', + 'key': 1422658800000, + 'doc_count': 9 + }, + { + 'key_as_string': '2015-01-31T00:00:00.000Z', + 'key': 1422662400000, + 'doc_count': 29 + }, + { + 'key_as_string': '2015-01-31T01:00:00.000Z', + 'key': 1422666000000, + 'doc_count': 38 + }, + { + 'key_as_string': '2015-01-31T02:00:00.000Z', + 'key': 1422669600000, + 'doc_count': 70 + }, + { + 'key_as_string': '2015-01-31T03:00:00.000Z', + 'key': 1422673200000, + 'doc_count': 136 + }, + { + 'key_as_string': '2015-01-31T04:00:00.000Z', + 'key': 1422676800000, + 'doc_count': 173 + }, + { + 'key_as_string': '2015-01-31T05:00:00.000Z', + 'key': 1422680400000, + 'doc_count': 370 + }, + { + 'key_as_string': '2015-01-31T06:00:00.000Z', + 'key': 1422684000000, + 'doc_count': 545 + }, + { + 'key_as_string': '2015-01-31T07:00:00.000Z', + 'key': 1422687600000, + 'doc_count': 845 + }, + { + 'key_as_string': '2015-01-31T08:00:00.000Z', + 'key': 1422691200000, + 'doc_count': 1070 + }, + { + 'key_as_string': '2015-01-31T09:00:00.000Z', + 'key': 1422694800000, + 'doc_count': 1419 + }, + { + 'key_as_string': '2015-01-31T10:00:00.000Z', + 'key': 1422698400000, + 'doc_count': 1725 + }, + { + 'key_as_string': '2015-01-31T11:00:00.000Z', + 'key': 1422702000000, + 'doc_count': 1801 + }, + { + 'key_as_string': '2015-01-31T12:00:00.000Z', + 'key': 1422705600000, + 'doc_count': 1823 + }, + { + 'key_as_string': '2015-01-31T13:00:00.000Z', + 'key': 1422709200000, + 'doc_count': 1657 + }, + { + 'key_as_string': '2015-01-31T14:00:00.000Z', + 'key': 1422712800000, + 'doc_count': 1454 + }, + { + 'key_as_string': '2015-01-31T15:00:00.000Z', + 'key': 1422716400000, + 'doc_count': 1131 + }, + { + 'key_as_string': '2015-01-31T16:00:00.000Z', + 'key': 1422720000000, + 'doc_count': 810 + }, + { + 'key_as_string': '2015-01-31T17:00:00.000Z', + 'key': 1422723600000, + 'doc_count': 583 + }, + { + 'key_as_string': '2015-01-31T18:00:00.000Z', + 'key': 1422727200000, + 'doc_count': 384 + }, + { + 'key_as_string': '2015-01-31T19:00:00.000Z', + 'key': 1422730800000, + 'doc_count': 165 + }, + { + 'key_as_string': '2015-01-31T20:00:00.000Z', + 'key': 1422734400000, + 'doc_count': 135 + }, + { + 'key_as_string': '2015-01-31T21:00:00.000Z', + 'key': 1422738000000, + 'doc_count': 72 + }, + { + 'key_as_string': '2015-01-31T22:00:00.000Z', + 'key': 1422741600000, + 'doc_count': 8 + } + ] + } + } + }; +}); \ No newline at end of file diff --git a/bin/fixtures/agg_resp/geohash_grid.js b/bin/fixtures/agg_resp/geohash_grid.js new file mode 100644 index 00000000000000..df9b6513de6b9d --- /dev/null +++ b/bin/fixtures/agg_resp/geohash_grid.js @@ -0,0 +1,83 @@ +define(function (require) { + return function GeoHashGridAggResponseFixture() { + + var _ = require('lodash'); + + // for vis: + // + // vis = new Vis(indexPattern, { + // type: 'tile_map', + // aggs:[ + // { schema: 'metric', type: 'avg', params: { field: 'bytes' } }, + // { schema: 'split', type: 'terms', params: { field: '@tags', size: 10 } }, + // { schema: 'segment', type: 'geohash_grid', params: { field: 'geo.coordinates', precision: 3 } } + // ], + // params: { + // isDesaturated: true, + // mapType: 'Scaled%20Circle%20Markers' + // }, + // }); + + var geoHashCharts = _.union( + _.range(48, 57), // 0-9 + _.range(65, 90), // A-Z + _.range(97, 122) // a-z + ); + + var totalDocCount = 0; + + var tags = _.times(_.random(4, 20), function (i) { + // random number of tags + var docCount = 0; + var buckets = _.times(_.random(40, 200), function () { + return _.sample(geoHashCharts, 3).join(''); + }) + .sort() + .map(function (geoHash) { + var count = _.random(1, 5000); + + totalDocCount += count; + docCount += count; + + return { + key: geoHash, + doc_count: count, + 1: { + value: 2048 + i + } + }; + }); + + return { + key: 'tag ' + (i + 1), + doc_count: docCount, + 3: { + buckets: buckets + }, + 1: { + value: 1000 + i + } + }; + }); + + return { + took: 3, + timed_out: false, + _shards: { + total: 4, + successful: 4, + failed: 0 + }, + hits: { + total: 298, + max_score: 0.0, + hits: [] + }, + aggregations: { + 2: { + buckets: tags + } + } + }; + }; +}); diff --git a/bin/fixtures/agg_resp/range.js b/bin/fixtures/agg_resp/range.js new file mode 100644 index 00000000000000..c571d1e1d2ae1b --- /dev/null +++ b/bin/fixtures/agg_resp/range.js @@ -0,0 +1,37 @@ +module.exports = { + "took": 35, + "timed_out": false, + "_shards": { + "total": 7, + "successful": 7, + "failed": 0 + }, + "hits": { + "total": 218512, + "max_score": 0, + "hits": [] + }, + "aggregations": { + "1": { + "buckets": { + "*-1024.0": { + "to": 1024, + "to_as_string": "1024.0", + "doc_count": 20904 + }, + "1024.0-2560.0": { + "from": 1024, + "from_as_string": "1024.0", + "to": 2560, + "to_as_string": "2560.0", + "doc_count": 23358 + }, + "2560.0-*": { + "from": 2560, + "from_as_string": "2560.0", + "doc_count": 174250 + } + } + } + } +}; diff --git a/bin/fixtures/config_upgrade_from_4.0.0.json b/bin/fixtures/config_upgrade_from_4.0.0.json new file mode 100644 index 00000000000000..522de78648c9bd --- /dev/null +++ b/bin/fixtures/config_upgrade_from_4.0.0.json @@ -0,0 +1,25 @@ +{ + "took": 1, + "timed_out": false, + "_shards": { + "total": 1, + "successful": 1, + "failed": 0 + }, + "hits": { + "total": 1, + "max_score": 1, + "hits": [ + { + "_index": ".kibana", + "_type": "config", + "_id": "4.0.0", + "_score": 1, + "_source": { + "buildNum": 5888, + "defaultIndex": "logstash-*" + } + } + ] + } +} diff --git a/bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json b/bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json new file mode 100644 index 00000000000000..30990d109cad11 --- /dev/null +++ b/bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1-snapshot.json @@ -0,0 +1,35 @@ +{ + "took": 1, + "timed_out": false, + "_shards": { + "total": 1, + "successful": 1, + "failed": 0 + }, + "hits": { + "total": 2, + "max_score": 1, + "hits": [ + { + "_index": ".kibana", + "_type": "config", + "_id": "4.0.1-snapshot", + "_score": 1, + "_source": { + "buildNum": 5921, + "defaultIndex": "logstash-*" + } + }, + { + "_index": ".kibana", + "_type": "config", + "_id": "4.0.0", + "_score": 1, + "_source": { + "buildNum": 5888, + "defaultIndex": "logstash-*" + } + } + ] + } +} diff --git a/bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json b/bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json new file mode 100644 index 00000000000000..57b486491b397a --- /dev/null +++ b/bin/fixtures/config_upgrade_from_4.0.0_to_4.0.1.json @@ -0,0 +1,35 @@ +{ + "took": 1, + "timed_out": false, + "_shards": { + "total": 1, + "successful": 1, + "failed": 0 + }, + "hits": { + "total": 2, + "max_score": 1, + "hits": [ + { + "_index": ".kibana", + "_type": "config", + "_id": "4.0.1", + "_score": 1, + "_source": { + "buildNum": 5921, + "defaultIndex": "logstash-*" + } + }, + { + "_index": ".kibana", + "_type": "config", + "_id": "4.0.0", + "_score": 1, + "_source": { + "buildNum": 5888, + "defaultIndex": "logstash-*" + } + } + ] + } +} diff --git a/bin/fixtures/fake_chart_events.js b/bin/fixtures/fake_chart_events.js new file mode 100644 index 00000000000000..f011fbade44f9c --- /dev/null +++ b/bin/fixtures/fake_chart_events.js @@ -0,0 +1,22 @@ +define(function (require) { + var results = {}; + + results.timeSeries = { + data: { + ordered: { + date: true, + interval: 600000, + max: 1414437217559, + min: 1414394017559 + } + }, + label: 'apache', + value: 44, + point: { + label: 'apache', + x: 1414400400000, + y: 44, + y0: 0 + } + }; +}); diff --git a/bin/fixtures/fake_hierarchical_data.js b/bin/fixtures/fake_hierarchical_data.js new file mode 100644 index 00000000000000..36797d0773e506 --- /dev/null +++ b/bin/fixtures/fake_hierarchical_data.js @@ -0,0 +1,228 @@ +define(function (require) { + var data = { }; + + data.metricOnly = { + hits: { total: 1000, hits: [], max_score: 0 }, + aggregations: { + agg_1: { value: 412032 }, + } + }; + + data.threeTermBuckets = { + hits: { total: 1000, hits: [], max_score: 0 }, + aggregations: { + agg_2: { + buckets: [ + { + key: 'png', + doc_count: 50, + agg_1: { value: 412032 }, + agg_3: { + buckets: [ + { + key: 'IT', + doc_count: 10, + agg_1: { value: 9299 }, + agg_4: { + buckets: [ + { key: 'win', doc_count: 4, agg_1: { value: 0 } }, + { key: 'mac', doc_count: 6, agg_1: { value: 9299 } } + ] + } + }, + { + key: 'US', + doc_count: 20, + agg_1: { value: 8293 }, + agg_4: { + buckets: [ + { key: 'linux', doc_count: 12, agg_1: { value: 3992 } }, + { key: 'mac', doc_count: 8, agg_1: { value: 3029 } } + ] + } + } + ] + } + }, + { + key: 'css', + doc_count: 20, + agg_1: { value: 412032 }, + agg_3: { + buckets: [ + { + key: 'MX', + doc_count: 7, + agg_1: { value: 9299 }, + agg_4: { + buckets: [ + { key: 'win', doc_count: 3, agg_1: { value: 4992 } }, + { key: 'mac', doc_count: 4, agg_1: { value: 5892 } } + ] + } + }, + { + key: 'US', + doc_count: 13, + agg_1: { value: 8293 }, + agg_4: { + buckets: [ + { key: 'linux', doc_count: 12, agg_1: { value: 3992 } }, + { key: 'mac', doc_count: 1, agg_1: { value: 3029 } } + ] + } + } + ] + } + }, + { + key: 'html', + doc_count: 90, + agg_1: { value: 412032 }, + agg_3: { + buckets: [ + { + key: 'CN', + doc_count: 85, + agg_1: { value: 9299 }, + agg_4: { + buckets: [ + { key: 'win', doc_count: 46, agg_1: { value: 4992 } }, + { key: 'mac', doc_count: 39, agg_1: { value: 5892 } } + ] + } + }, + { + key: 'FR', + doc_count: 15, + agg_1: { value: 8293 }, + agg_4: { + buckets: [ + { key: 'win', doc_count: 3, agg_1: { value: 3992 } }, + { key: 'mac', doc_count: 12, agg_1: { value: 3029 } } + ] + } + } + ] + } + } + ] + } + } + }; + + data.oneRangeBucket = { + 'took': 35, + 'timed_out': false, + '_shards': { + 'total': 1, + 'successful': 1, + 'failed': 0 + }, + 'hits': { + 'total': 6039, + 'max_score': 0, + 'hits': [] + }, + 'aggregations': { + 'agg_2': { + 'buckets': { + '0.0-1000.0': { + 'from': 0, + 'from_as_string': '0.0', + 'to': 1000, + 'to_as_string': '1000.0', + 'doc_count': 606 + }, + '1000.0-2000.0': { + 'from': 1000, + 'from_as_string': '1000.0', + 'to': 2000, + 'to_as_string': '2000.0', + 'doc_count': 298 + } + } + } + } + }; + + data.oneFilterBucket = { + 'took': 11, + 'timed_out': false, + '_shards': { + 'total': 1, + 'successful': 1, + 'failed': 0 + }, + 'hits': { + 'total': 6005, + 'max_score': 0, + 'hits': [] + }, + 'aggregations': { + 'agg_2': { + 'buckets': { + '_type:apache': { + 'doc_count': 4844 + }, + '_type:nginx': { + 'doc_count': 1161 + } + } + } + } + }; + + data.oneHistogramBucket = { + 'took': 37, + 'timed_out': false, + '_shards': { + 'total': 6, + 'successful': 6, + 'failed': 0 + }, + 'hits': { + 'total': 49208, + 'max_score': 0, + 'hits': [] + }, + 'aggregations': { + 'agg_2': { + 'buckets': [ + { + 'key_as_string': '2014-09-28T00:00:00.000Z', + 'key': 1411862400000, + 'doc_count': 8247 + }, + { + 'key_as_string': '2014-09-29T00:00:00.000Z', + 'key': 1411948800000, + 'doc_count': 8184 + }, + { + 'key_as_string': '2014-09-30T00:00:00.000Z', + 'key': 1412035200000, + 'doc_count': 8269 + }, + { + 'key_as_string': '2014-10-01T00:00:00.000Z', + 'key': 1412121600000, + 'doc_count': 8141 + }, + { + 'key_as_string': '2014-10-02T00:00:00.000Z', + 'key': 1412208000000, + 'doc_count': 8148 + }, + { + 'key_as_string': '2014-10-03T00:00:00.000Z', + 'key': 1412294400000, + 'doc_count': 8219 + } + ] + } + } + }; + + return data; +}); diff --git a/bin/fixtures/fake_row.js b/bin/fixtures/fake_row.js new file mode 100644 index 00000000000000..855d6bd7e50af2 --- /dev/null +++ b/bin/fixtures/fake_row.js @@ -0,0 +1,22 @@ +define(function (require) { + var _ = require('lodash'); + var longString = Array(200).join('_'); + + return function (id, mapping) { + function fakeVals(type) { + return _.mapValues(mapping, function (f, c) { + return c + '_' + type + '_' + id + longString; + }); + } + + return { + _id: id, + _index: 'test', + _source: fakeVals('original'), + sort: [id], + $$_formatted: fakeVals('formatted'), + $$_partialFormatted: fakeVals('formatted'), + $$_flattened: fakeVals('_flattened') + }; + }; +}); diff --git a/bin/fixtures/field_mapping.js b/bin/fixtures/field_mapping.js new file mode 100644 index 00000000000000..fa18a02a68a0c5 --- /dev/null +++ b/bin/fixtures/field_mapping.js @@ -0,0 +1,62 @@ +define(function (require) { + return { + test: { + mappings: { + testType: { + 'baz': { + full_name: 'baz', + mapping: { + bar: { + type: 'long' + } + } + }, + 'foo.bar': { + full_name: 'foo.bar', + mapping: { + bar: { + type: 'string', + } + } + }, + 'not_analyzed_field': { + full_name: 'not_analyzed_field', + mapping: { + bar: { + type: 'string', + index: 'not_analyzed' + } + } + }, + 'index_no_field': { + full_name: 'index_no_field', + mapping: { + bar: { + type: 'string', + index: 'no' + } + } + }, + _id: { + full_name: '_id', + mapping: { + _id: { + store: false, + index: 'no', + } + } + }, + _timestamp: { + full_name: '_timestamp', + mapping: { + _timestamp: { + store: true, + index: 'no', + } + } + } + } + } + } + }; +}); \ No newline at end of file diff --git a/bin/fixtures/filter_skeleton.js b/bin/fixtures/filter_skeleton.js new file mode 100644 index 00000000000000..f1eb523d428d28 --- /dev/null +++ b/bin/fixtures/filter_skeleton.js @@ -0,0 +1,7 @@ +define(function (require) { + return { + meta: { + index: 'logstash-*' + } + }; +}); diff --git a/bin/fixtures/hits.js b/bin/fixtures/hits.js new file mode 100644 index 00000000000000..92665b504bbeaa --- /dev/null +++ b/bin/fixtures/hits.js @@ -0,0 +1,24 @@ +define(function (require) { + var _ = require('lodash'); + return function fitsFixture() { + return _.map([ + {_source: {'@timestamp': 0, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 10, request: 'foo'}}, + {_source: {'@timestamp': 1, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 20, request: 'bar'}}, + {_source: {'@timestamp': 2, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'bar'}}, + {_source: {'@timestamp': 3, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'baz'}}, + {_source: {'@timestamp': 4, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'baz'}}, + {_source: {'@timestamp': 5, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'baz'}}, + {_source: {'@timestamp': 6, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}}, + {_source: {'@timestamp': 7, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}}, + {_source: {'@timestamp': 8, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}}, + {_source: {'@timestamp': 9, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}}, + ], function (p, i) { + return _.merge({}, p, { + _score: 1, + _id: 1000 + i, + _type: 'test', + _index: 'test-index' + }); + }); + }; +}); diff --git a/bin/fixtures/logstash_fields.js b/bin/fixtures/logstash_fields.js new file mode 100644 index 00000000000000..ec6a36e33d7b1b --- /dev/null +++ b/bin/fixtures/logstash_fields.js @@ -0,0 +1,37 @@ +define(function (require) { + function stubbedLogstashFields() { + var sourceData = [ + { name: 'bytes', type: 'number', indexed: true, analyzed: true, sortable: true, filterable: true, count: 10 }, + { name: 'ssl', type: 'boolean', indexed: true, analyzed: true, sortable: true, filterable: true, count: 20 }, + { name: '@timestamp', type: 'date', indexed: true, analyzed: true, sortable: true, filterable: true, count: 30 }, + { name: 'time', type: 'date', indexed: true, analyzed: true, sortable: true, filterable: true, count: 30 }, + { name: '@tags', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: 'utc_time', type: 'date', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: 'phpmemory', type: 'number', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: 'ip', type: 'ip', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: 'request_body', type: 'attachment', indexed: true, analyzed: true, sortable: false, filterable: true }, + { name: 'point', type: 'geo_point', indexed: true, analyzed: true, sortable: false, filterable: false }, + { name: 'area', type: 'geo_shape', indexed: true, analyzed: true, sortable: true, filterable: false }, + { name: 'hashed', type: 'murmur3', indexed: true, analyzed: true, sortable: false, filterable: false }, + { name: 'geo.coordinates', type: 'geo_point', indexed: true, analyzed: true, sortable: false, filterable: true }, + { name: 'extension', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: 'machine.os', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: 'geo.src', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: '_type', type: 'string', indexed: true, analyzed: true, sortable: true, filterable: true }, + { name: '_id', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: true}, + { name: '_source', type: 'string', indexed: false, analyzed: false, sortable: false, filterable: false}, + { name: 'custom_user_field', type: 'conflict', indexed: false, analyzed: false, sortable: false, filterable: true }, + { name: 'script string', type: 'string', scripted: true, script: '\'i am a string\'', lang: 'expression' }, + { name: 'script number', type: 'number', scripted: true, script: '1234', lang: 'expression' }, + { name: 'script murmur3', type: 'murmur3', scripted: true, script: '1234', lang: 'expression'}, + ].map(function (field) { + field.count = field.count || 0; + field.scripted = field.scripted || false; + return field; + }); + + return sourceData; + } + + return stubbedLogstashFields; +}); diff --git a/bin/fixtures/mapping_with_dupes.js b/bin/fixtures/mapping_with_dupes.js new file mode 100644 index 00000000000000..d43f8ebc8a694a --- /dev/null +++ b/bin/fixtures/mapping_with_dupes.js @@ -0,0 +1,40 @@ +define(function (require) { + return { + test: { + mappings: { + testType: { + 'baz': { + full_name: 'baz', + mapping: { + bar: { + type: 'long' + } + } + }, + 'foo.bar': { + full_name: 'foo.bar', + mapping: { + bar: { + type: 'string' + } + } + } + } + } + }, + duplicates: { + mappings: { + testType: { + 'baz': { + full_name: 'baz', + mapping: { + bar: { + type: 'date' + } + } + } + } + } + } + }; +}); \ No newline at end of file diff --git a/bin/fixtures/mock_courier.js b/bin/fixtures/mock_courier.js new file mode 100644 index 00000000000000..07e6de0091f627 --- /dev/null +++ b/bin/fixtures/mock_courier.js @@ -0,0 +1,17 @@ +define(function (require) { + var _ = require('lodash'); + var sinon = require('auto-release-sinon'); + + return function (Private, Promise) { + var indexPatterns = Private(require('fixtures/stubbed_logstash_index_pattern')); + var getIndexPatternStub = sinon.stub(); + getIndexPatternStub.returns(Promise.resolve(indexPatterns)); + + var courier = { + indexPatterns: { get: getIndexPatternStub }, + getStub: getIndexPatternStub + }; + + return courier; + }; +}); diff --git a/bin/fixtures/mock_state.js b/bin/fixtures/mock_state.js new file mode 100644 index 00000000000000..1346b8386ec020 --- /dev/null +++ b/bin/fixtures/mock_state.js @@ -0,0 +1,18 @@ +define(function (require) { + var _ = require('lodash'); + var sinon = require('auto-release-sinon'); + + function MockState(defaults) { + this.on = _.noop; + this.off = _.noop; + this.save = sinon.stub(); + _.assign(this, defaults); + } + + MockState.prototype.resetStub = function () { + this.save = sinon.stub(); + return this; + }; + + return MockState; +}); diff --git a/bin/fixtures/real_hits.js b/bin/fixtures/real_hits.js new file mode 100644 index 00000000000000..55047c2f41da25 --- /dev/null +++ b/bin/fixtures/real_hits.js @@ -0,0 +1,227 @@ +define(function (require) { + + /* + Extensions: + gif: 5 + html: 8 + php: 5 (thus 5 with phpmemory fields) + png: 2 + + _type: + apache: 18 + nginx: 2 + + Bytes (all unique except): + 374: 2 + + All have the same index, ids are unique + */ + + return [ + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '61', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 360.20000000000005 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '388', + '_score': 1, + '_source': { + 'extension': 'gif', + 'bytes': 5848.700000000001 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '403', + '_score': 1, + '_source': { + 'extension': 'png', + 'bytes': 841.6 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '415', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 1626.4 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '460', + '_score': 1, + '_source': { + 'extension': 'php', + 'bytes': 2070.6, + 'phpmemory': 276080 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '496', + '_score': 1, + '_source': { + 'extension': 'gif', + 'bytes': 8421.6 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '511', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 994.8000000000001 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '701', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 374 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '838', + '_score': 1, + '_source': { + 'extension': 'php', + 'bytes': 506.09999999999997, + 'phpmemory': 67480 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '890', + '_score': 1, + '_source': { + 'extension': 'php', + 'bytes': 506.09999999999997, + 'phpmemory': 67480 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'nginx', + '_id': '927', + '_score': 1, + '_source': { + 'extension': 'php', + 'bytes': 2591.1, + 'phpmemory': 345480 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1034', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 1450 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1142', + '_score': 1, + '_source': { + 'extension': 'php', + 'bytes': 1803.8999999999999, + 'phpmemory': 240520 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1180', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 1626.4 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'nginx', + '_id': '1224', + '_score': 1, + '_source': { + 'extension': 'gif', + 'bytes': 10617.2 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1243', + '_score': 1, + '_source': { + 'extension': 'gif', + 'bytes': 10961.5 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1510', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 382.8 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1628', + '_score': 1, + '_source': { + 'extension': 'html', + 'bytes': 374 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1729', + '_score': 1, + '_source': { + 'extension': 'png', + 'bytes': 3059.2000000000003 + } + }, + { + '_index': 'logstash-2014.09.09', + '_type': 'apache', + '_id': '1945', + '_score': 1, + '_source': { + 'extension': 'gif', + 'bytes': 10617.2 + } + } + ]; +}); diff --git a/bin/fixtures/require_from.js b/bin/fixtures/require_from.js new file mode 100644 index 00000000000000..e69de29bb2d1d6 diff --git a/bin/fixtures/search_response.js b/bin/fixtures/search_response.js new file mode 100644 index 00000000000000..3c0b495da06a4e --- /dev/null +++ b/bin/fixtures/search_response.js @@ -0,0 +1,18 @@ +define(function (require) { + var hits = require('fixtures/real_hits'); + + return { + took: 73, + timed_out: false, + _shards: { + total: 144, + successful: 144, + failed: 0 + }, + hits: { + total : 49487, + max_score : 1.0, + hits: hits + } + }; +}); \ No newline at end of file diff --git a/bin/fixtures/stubbed_doc_source_response.js b/bin/fixtures/stubbed_doc_source_response.js new file mode 100644 index 00000000000000..a26f73c1f7786e --- /dev/null +++ b/bin/fixtures/stubbed_doc_source_response.js @@ -0,0 +1,22 @@ +define(function (require) { + function stubbedDocSourceResponse(Private) { + var mockLogstashFields = Private(require('fixtures/logstash_fields')); + + return function (id, index) { + index = index || '.kibana'; + return { + _id: id, + _index: index, + _type: 'index-pattern', + _version: 2, + found: true, + _source: { + customFormats: '{}', + fields: JSON.stringify(mockLogstashFields) + } + }; + }; + } + + return stubbedDocSourceResponse; +}); \ No newline at end of file diff --git a/bin/fixtures/stubbed_logstash_index_pattern.js b/bin/fixtures/stubbed_logstash_index_pattern.js new file mode 100644 index 00000000000000..2b114919a81e5a --- /dev/null +++ b/bin/fixtures/stubbed_logstash_index_pattern.js @@ -0,0 +1,24 @@ +define(function (require) { + return function stubbedLogstashIndexPatternService(Private) { + var StubIndexPattern = Private(require('testUtils/stubIndexPattern')); + var fieldTypes = Private(require('ui/index_patterns/_field_types')); + var mockLogstashFields = Private(require('fixtures/logstash_fields')); + + var _ = require('lodash'); + + var fields = mockLogstashFields.map(function (field) { + field.displayName = field.name; + var type = fieldTypes.byName[field.type]; + if (!type) throw new TypeError('unknown type ' + field.type); + if (!_.has(field, 'sortable')) field.sortable = type.sortable; + if (!_.has(field, 'filterable')) field.filterable = type.filterable; + return field; + }); + + var indexPattern = new StubIndexPattern('logstash-*', 'time', fields); + indexPattern.id = 'logstash-*'; + + return indexPattern; + + }; +}); diff --git a/bin/fixtures/stubbed_search_source.js b/bin/fixtures/stubbed_search_source.js new file mode 100644 index 00000000000000..d80e52c6cf5c34 --- /dev/null +++ b/bin/fixtures/stubbed_search_source.js @@ -0,0 +1,36 @@ +define(function (require) { + var sinon = require('auto-release-sinon'); + var searchResponse = require('fixtures/search_response'); + + return function stubSearchSource(Private, $q) { + var deferedResult = $q.defer(); + + return { + sort: sinon.spy(), + size: sinon.spy(), + fetch: sinon.spy(), + destroy: sinon.spy(), + get: function (param) { + switch (param) { + case 'index': + return Private(require('fixtures/stubbed_logstash_index_pattern')); + default: + throw new Error('Param "' + param + '" is not implemented in the stubbed search source'); + } + }, + crankResults: function () { + deferedResult.resolve(searchResponse); + deferedResult = $q.defer(); + }, + onResults: function () { + // Up to the test to resolve this manually + // For example: + // someHandler.resolve(require('fixtures/search_response')) + return deferedResult.promise; + }, + onError: function () { return $q.defer().promise; }, + + }; + + }; +}); diff --git a/bin/fixtures/tilemap_map.js b/bin/fixtures/tilemap_map.js new file mode 100644 index 00000000000000..5d07de83492128 --- /dev/null +++ b/bin/fixtures/tilemap_map.js @@ -0,0 +1,21 @@ +define(function (require) { + var sinon = require('auto-release-sinon'); + + function MockMap(container, chartData, params) { + this.container = container; + this.chartData = chartData; + this.params = params; + + // stub required methods + this.addStubs(); + } + + MockMap.prototype.addStubs = function () { + this.addTitle = sinon.stub(); + this.addFitControl = sinon.stub(); + this.addBoundingControl = sinon.stub(); + this.destroy = sinon.stub(); + }; + + return MockMap; +}); \ No newline at end of file diff --git a/bin/fixtures/vislib/_vis_fixture.js b/bin/fixtures/vislib/_vis_fixture.js new file mode 100644 index 00000000000000..d7e74a634f3c01 --- /dev/null +++ b/bin/fixtures/vislib/_vis_fixture.js @@ -0,0 +1,33 @@ +var $ = require('jquery'); +var _ = require('lodash'); + +var $visCanvas = $('
').attr('id', 'vislib-vis-fixtures').appendTo('body'); +var count = 0; +var visHeight = $visCanvas.height(); + +$visCanvas.new = function () { + count += 1; + if (count > 1) $visCanvas.height(visHeight * count); + return $('
').addClass('visualize-chart').appendTo($visCanvas); +}; + +afterEach(function () { + $visCanvas.empty(); + if (count > 1) $visCanvas.height(visHeight); + count = 0; +}); + +module.exports = function VislibFixtures(Private) { + return function (visLibParams) { + var Vis = Private(require('ui/vislib/vis')); + return new Vis($visCanvas.new(), _.defaults({}, visLibParams || {}, { + shareYAxis: true, + addTooltip: true, + addLegend: true, + defaultYExtents: false, + setYExtents: false, + yAxis: {}, + type: 'histogram' + })); + }; +}; diff --git a/bin/fixtures/vislib/mock_data/date_histogram/_columns.js b/bin/fixtures/vislib/mock_data/date_histogram/_columns.js new file mode 100644 index 00000000000000..6fa4d1ee8aad29 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/date_histogram/_columns.js @@ -0,0 +1,264 @@ +var moment = require('moment'); + +module.exports = { + 'columns': [ + { + 'label': '200: response', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'interval': 30000, + 'min': 1415826608440, + 'max': 1415827508440 + }, + 'yAxisLabel': 'Count of documents', + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + }, + 'series': [ + { + 'values': [ + { + 'x': 1415826600000, + 'y': 4 + }, + { + 'x': 1415826630000, + 'y': 8 + }, + { + 'x': 1415826660000, + 'y': 7 + }, + { + 'x': 1415826690000, + 'y': 5 + }, + { + 'x': 1415826720000, + 'y': 5 + }, + { + 'x': 1415826750000, + 'y': 4 + }, + { + 'x': 1415826780000, + 'y': 10 + }, + { + 'x': 1415826810000, + 'y': 7 + }, + { + 'x': 1415826840000, + 'y': 9 + }, + { + 'x': 1415826870000, + 'y': 8 + }, + { + 'x': 1415826900000, + 'y': 9 + }, + { + 'x': 1415826930000, + 'y': 8 + }, + { + 'x': 1415826960000, + 'y': 3 + }, + { + 'x': 1415826990000, + 'y': 9 + }, + { + 'x': 1415827020000, + 'y': 6 + }, + { + 'x': 1415827050000, + 'y': 8 + }, + { + 'x': 1415827080000, + 'y': 7 + }, + { + 'x': 1415827110000, + 'y': 4 + }, + { + 'x': 1415827140000, + 'y': 6 + }, + { + 'x': 1415827170000, + 'y': 10 + }, + { + 'x': 1415827200000, + 'y': 2 + }, + { + 'x': 1415827230000, + 'y': 8 + }, + { + 'x': 1415827260000, + 'y': 5 + }, + { + 'x': 1415827290000, + 'y': 6 + }, + { + 'x': 1415827320000, + 'y': 6 + }, + { + 'x': 1415827350000, + 'y': 10 + }, + { + 'x': 1415827380000, + 'y': 6 + }, + { + 'x': 1415827410000, + 'y': 6 + }, + { + 'x': 1415827440000, + 'y': 12 + }, + { + 'x': 1415827470000, + 'y': 9 + }, + { + 'x': 1415827500000, + 'y': 1 + } + ] + } + ] + }, + { + 'label': '503: response', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'interval': 30000, + 'min': 1415826608440, + 'max': 1415827508440 + }, + 'yAxisLabel': 'Count of documents', + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + }, + 'series': [ + { + 'values': [ + { + 'x': 1415826630000, + 'y': 1 + }, + { + 'x': 1415826660000, + 'y': 1 + }, + { + 'x': 1415826720000, + 'y': 1 + }, + { + 'x': 1415826780000, + 'y': 1 + }, + { + 'x': 1415826900000, + 'y': 1 + }, + { + 'x': 1415827020000, + 'y': 1 + }, + { + 'x': 1415827080000, + 'y': 1 + }, + { + 'x': 1415827110000, + 'y': 2 + } + ] + } + ] + }, + { + 'label': '404: response', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'interval': 30000, + 'min': 1415826608440, + 'max': 1415827508440 + }, + 'yAxisLabel': 'Count of documents', + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + }, + 'series': [ + { + 'values': [ + { + 'x': 1415826660000, + 'y': 1 + }, + { + 'x': 1415826720000, + 'y': 1 + }, + { + 'x': 1415826810000, + 'y': 1 + }, + { + 'x': 1415826960000, + 'y': 1 + }, + { + 'x': 1415827050000, + 'y': 1 + }, + { + 'x': 1415827260000, + 'y': 1 + }, + { + 'x': 1415827380000, + 'y': 1 + }, + { + 'x': 1415827410000, + 'y': 1 + } + ] + } + ] + } + ], + 'hits': 225 +}; diff --git a/bin/fixtures/vislib/mock_data/date_histogram/_rows.js b/bin/fixtures/vislib/mock_data/date_histogram/_rows.js new file mode 100644 index 00000000000000..c2ff7a40de5f5f --- /dev/null +++ b/bin/fixtures/vislib/mock_data/date_histogram/_rows.js @@ -0,0 +1,1645 @@ +var moment = require('moment'); + +module.exports = { + 'rows': [ + { + 'label': '0.0-1000.0: bytes', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'interval': 30000, + 'min': 1415826260456, + 'max': 1415827160456 + }, + 'yAxisLabel': 'Count of documents', + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + }, + 'series': [ + { + 'label': 'jpg', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'css', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'png', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827110000, + 'y': 1, + 'y0': 1 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'php', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827110000, + 'y': 0, + 'y0': 2 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'gif', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 3, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826660000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 1, + 'y0': 1 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 1, + 'y0': 1 + }, + { + 'x': 1415827110000, + 'y': 1, + 'y0': 2 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + } + ] + }, + { + 'label': '1000.0-2000.0: bytes', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'interval': 30000, + 'min': 1415826260457, + 'max': 1415827160457 + }, + 'yAxisLabel': 'Count of documents', + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + }, + 'series': [ + { + 'label': 'jpg', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826660000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826810000, + 'y': 2, + 'y0': 0 + }, + { + 'x': 1415826840000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'css', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 2 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'png', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 2 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'php', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 2 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + }, + { + 'label': 'gif', + 'values': [ + { + 'x': 1415826240000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826270000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826300000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826330000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826360000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826390000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826420000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826450000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826480000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826510000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826540000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826570000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826600000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826630000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826660000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826690000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826720000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826750000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826780000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826810000, + 'y': 0, + 'y0': 2 + }, + { + 'x': 1415826840000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826870000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826900000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415826930000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826960000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415826990000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827020000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827050000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827080000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 1415827110000, + 'y': 0, + 'y0': 1 + }, + { + 'x': 1415827140000, + 'y': 0, + 'y0': 0 + } + ] + } + ] + } + ], + 'hits': 236 +}; diff --git a/bin/fixtures/vislib/mock_data/date_histogram/_series.js b/bin/fixtures/vislib/mock_data/date_histogram/_series.js new file mode 100644 index 00000000000000..7c126c41eb9d3b --- /dev/null +++ b/bin/fixtures/vislib/mock_data/date_histogram/_series.js @@ -0,0 +1,150 @@ +var moment = require('moment'); + +module.exports = { + 'label': '', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'min': 1411761457636, + 'max': 1411762357636, + 'interval': 30000 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 1411761450000, + 'y': 41 + }, + { + 'x': 1411761480000, + 'y': 18 + }, + { + 'x': 1411761510000, + 'y': 22 + }, + { + 'x': 1411761540000, + 'y': 17 + }, + { + 'x': 1411761570000, + 'y': 17 + }, + { + 'x': 1411761600000, + 'y': 21 + }, + { + 'x': 1411761630000, + 'y': 16 + }, + { + 'x': 1411761660000, + 'y': 17 + }, + { + 'x': 1411761690000, + 'y': 15 + }, + { + 'x': 1411761720000, + 'y': 19 + }, + { + 'x': 1411761750000, + 'y': 11 + }, + { + 'x': 1411761780000, + 'y': 13 + }, + { + 'x': 1411761810000, + 'y': 24 + }, + { + 'x': 1411761840000, + 'y': 20 + }, + { + 'x': 1411761870000, + 'y': 20 + }, + { + 'x': 1411761900000, + 'y': 21 + }, + { + 'x': 1411761930000, + 'y': 17 + }, + { + 'x': 1411761960000, + 'y': 20 + }, + { + 'x': 1411761990000, + 'y': 13 + }, + { + 'x': 1411762020000, + 'y': 14 + }, + { + 'x': 1411762050000, + 'y': 25 + }, + { + 'x': 1411762080000, + 'y': 17 + }, + { + 'x': 1411762110000, + 'y': 14 + }, + { + 'x': 1411762140000, + 'y': 22 + }, + { + 'x': 1411762170000, + 'y': 14 + }, + { + 'x': 1411762200000, + 'y': 19 + }, + { + 'x': 1411762230000, + 'y': 22 + }, + { + 'x': 1411762260000, + 'y': 17 + }, + { + 'x': 1411762290000, + 'y': 8 + }, + { + 'x': 1411762320000, + 'y': 15 + }, + { + 'x': 1411762350000, + 'y': 4 + } + ] + } + ], + 'hits': 533, + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/date_histogram/_series_neg.js b/bin/fixtures/vislib/mock_data/date_histogram/_series_neg.js new file mode 100644 index 00000000000000..a514c0000efcf3 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/date_histogram/_series_neg.js @@ -0,0 +1,150 @@ +var moment = require('moment'); + +module.exports = { + 'label': '', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'min': 1411761457636, + 'max': 1411762357636, + 'interval': 30000 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 1411761450000, + 'y': -41 + }, + { + 'x': 1411761480000, + 'y': -18 + }, + { + 'x': 1411761510000, + 'y': -22 + }, + { + 'x': 1411761540000, + 'y': -17 + }, + { + 'x': 1411761570000, + 'y': -17 + }, + { + 'x': 1411761600000, + 'y': -21 + }, + { + 'x': 1411761630000, + 'y': -16 + }, + { + 'x': 1411761660000, + 'y': -17 + }, + { + 'x': 1411761690000, + 'y': -15 + }, + { + 'x': 1411761720000, + 'y': -19 + }, + { + 'x': 1411761750000, + 'y': -11 + }, + { + 'x': 1411761780000, + 'y': -13 + }, + { + 'x': 1411761810000, + 'y': -24 + }, + { + 'x': 1411761840000, + 'y': -20 + }, + { + 'x': 1411761870000, + 'y': -20 + }, + { + 'x': 1411761900000, + 'y': -21 + }, + { + 'x': 1411761930000, + 'y': -17 + }, + { + 'x': 1411761960000, + 'y': -20 + }, + { + 'x': 1411761990000, + 'y': -13 + }, + { + 'x': 1411762020000, + 'y': -14 + }, + { + 'x': 1411762050000, + 'y': -25 + }, + { + 'x': 1411762080000, + 'y': -17 + }, + { + 'x': 1411762110000, + 'y': -14 + }, + { + 'x': 1411762140000, + 'y': -22 + }, + { + 'x': 1411762170000, + 'y': -14 + }, + { + 'x': 1411762200000, + 'y': -19 + }, + { + 'x': 1411762230000, + 'y': -22 + }, + { + 'x': 1411762260000, + 'y': -17 + }, + { + 'x': 1411762290000, + 'y': -8 + }, + { + 'x': 1411762320000, + 'y': -15 + }, + { + 'x': 1411762350000, + 'y': -4 + } + ] + } + ], + 'hits': 533, + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/date_histogram/_series_pos_neg.js b/bin/fixtures/vislib/mock_data/date_histogram/_series_pos_neg.js new file mode 100644 index 00000000000000..f7345c1e10c8ab --- /dev/null +++ b/bin/fixtures/vislib/mock_data/date_histogram/_series_pos_neg.js @@ -0,0 +1,150 @@ +var moment = require('moment'); + +module.exports = { + 'label': '', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'min': 1411761457636, + 'max': 1411762357636, + 'interval': 30000 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 1411761450000, + 'y': 41 + }, + { + 'x': 1411761480000, + 'y': 18 + }, + { + 'x': 1411761510000, + 'y': -22 + }, + { + 'x': 1411761540000, + 'y': -17 + }, + { + 'x': 1411761570000, + 'y': -17 + }, + { + 'x': 1411761600000, + 'y': -21 + }, + { + 'x': 1411761630000, + 'y': -16 + }, + { + 'x': 1411761660000, + 'y': 17 + }, + { + 'x': 1411761690000, + 'y': 15 + }, + { + 'x': 1411761720000, + 'y': 19 + }, + { + 'x': 1411761750000, + 'y': 11 + }, + { + 'x': 1411761780000, + 'y': -13 + }, + { + 'x': 1411761810000, + 'y': -24 + }, + { + 'x': 1411761840000, + 'y': -20 + }, + { + 'x': 1411761870000, + 'y': -20 + }, + { + 'x': 1411761900000, + 'y': -21 + }, + { + 'x': 1411761930000, + 'y': 17 + }, + { + 'x': 1411761960000, + 'y': 20 + }, + { + 'x': 1411761990000, + 'y': -13 + }, + { + 'x': 1411762020000, + 'y': -14 + }, + { + 'x': 1411762050000, + 'y': 25 + }, + { + 'x': 1411762080000, + 'y': -17 + }, + { + 'x': 1411762110000, + 'y': -14 + }, + { + 'x': 1411762140000, + 'y': -22 + }, + { + 'x': 1411762170000, + 'y': -14 + }, + { + 'x': 1411762200000, + 'y': 19 + }, + { + 'x': 1411762230000, + 'y': 22 + }, + { + 'x': 1411762260000, + 'y': 17 + }, + { + 'x': 1411762290000, + 'y': 8 + }, + { + 'x': 1411762320000, + 'y': -15 + }, + { + 'x': 1411762350000, + 'y': -4 + } + ] + } + ], + 'hits': 533, + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/date_histogram/_stacked_series.js b/bin/fixtures/vislib/mock_data/date_histogram/_stacked_series.js new file mode 100644 index 00000000000000..e124703fda6901 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/date_histogram/_stacked_series.js @@ -0,0 +1,1483 @@ +var moment = require('moment'); + +module.exports = { + 'label': '', + 'xAxisLabel': '@timestamp per 10 min', + 'ordered': { + 'date': true, + 'min': 1413544140087, + 'max': 1413587340087, + 'interval': 600000 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'label': 'html', + 'values': [ + { + 'x': 1413543600000, + 'y': 140 + }, + { + 'x': 1413544200000, + 'y': 1388 + }, + { + 'x': 1413544800000, + 'y': 1308 + }, + { + 'x': 1413545400000, + 'y': 1356 + }, + { + 'x': 1413546000000, + 'y': 1314 + }, + { + 'x': 1413546600000, + 'y': 1343 + }, + { + 'x': 1413547200000, + 'y': 1353 + }, + { + 'x': 1413547800000, + 'y': 1353 + }, + { + 'x': 1413548400000, + 'y': 1334 + }, + { + 'x': 1413549000000, + 'y': 1433 + }, + { + 'x': 1413549600000, + 'y': 1331 + }, + { + 'x': 1413550200000, + 'y': 1349 + }, + { + 'x': 1413550800000, + 'y': 1323 + }, + { + 'x': 1413551400000, + 'y': 1203 + }, + { + 'x': 1413552000000, + 'y': 1231 + }, + { + 'x': 1413552600000, + 'y': 1227 + }, + { + 'x': 1413553200000, + 'y': 1187 + }, + { + 'x': 1413553800000, + 'y': 1119 + }, + { + 'x': 1413554400000, + 'y': 1159 + }, + { + 'x': 1413555000000, + 'y': 1117 + }, + { + 'x': 1413555600000, + 'y': 1152 + }, + { + 'x': 1413556200000, + 'y': 1057 + }, + { + 'x': 1413556800000, + 'y': 1009 + }, + { + 'x': 1413557400000, + 'y': 979 + }, + { + 'x': 1413558000000, + 'y': 975 + }, + { + 'x': 1413558600000, + 'y': 848 + }, + { + 'x': 1413559200000, + 'y': 873 + }, + { + 'x': 1413559800000, + 'y': 808 + }, + { + 'x': 1413560400000, + 'y': 784 + }, + { + 'x': 1413561000000, + 'y': 799 + }, + { + 'x': 1413561600000, + 'y': 684 + }, + { + 'x': 1413562200000, + 'y': 727 + }, + { + 'x': 1413562800000, + 'y': 621 + }, + { + 'x': 1413563400000, + 'y': 615 + }, + { + 'x': 1413564000000, + 'y': 569 + }, + { + 'x': 1413564600000, + 'y': 523 + }, + { + 'x': 1413565200000, + 'y': 474 + }, + { + 'x': 1413565800000, + 'y': 470 + }, + { + 'x': 1413566400000, + 'y': 466 + }, + { + 'x': 1413567000000, + 'y': 394 + }, + { + 'x': 1413567600000, + 'y': 404 + }, + { + 'x': 1413568200000, + 'y': 389 + }, + { + 'x': 1413568800000, + 'y': 312 + }, + { + 'x': 1413569400000, + 'y': 274 + }, + { + 'x': 1413570000000, + 'y': 285 + }, + { + 'x': 1413570600000, + 'y': 299 + }, + { + 'x': 1413571200000, + 'y': 207 + }, + { + 'x': 1413571800000, + 'y': 213 + }, + { + 'x': 1413572400000, + 'y': 119 + }, + { + 'x': 1413573600000, + 'y': 122 + }, + { + 'x': 1413574200000, + 'y': 169 + }, + { + 'x': 1413574800000, + 'y': 151 + }, + { + 'x': 1413575400000, + 'y': 152 + }, + { + 'x': 1413576000000, + 'y': 115 + }, + { + 'x': 1413576600000, + 'y': 117 + }, + { + 'x': 1413577200000, + 'y': 108 + }, + { + 'x': 1413577800000, + 'y': 100 + }, + { + 'x': 1413578400000, + 'y': 78 + }, + { + 'x': 1413579000000, + 'y': 88 + }, + { + 'x': 1413579600000, + 'y': 63 + }, + { + 'x': 1413580200000, + 'y': 58 + }, + { + 'x': 1413580800000, + 'y': 45 + }, + { + 'x': 1413581400000, + 'y': 57 + }, + { + 'x': 1413582000000, + 'y': 34 + }, + { + 'x': 1413582600000, + 'y': 41 + }, + { + 'x': 1413583200000, + 'y': 24 + }, + { + 'x': 1413583800000, + 'y': 27 + }, + { + 'x': 1413584400000, + 'y': 19 + }, + { + 'x': 1413585000000, + 'y': 24 + }, + { + 'x': 1413585600000, + 'y': 18 + }, + { + 'x': 1413586200000, + 'y': 17 + }, + { + 'x': 1413586800000, + 'y': 14 + } + ] + }, + { + 'label': 'php', + 'values': [ + { + 'x': 1413543600000, + 'y': 90 + }, + { + 'x': 1413544200000, + 'y': 949 + }, + { + 'x': 1413544800000, + 'y': 1012 + }, + { + 'x': 1413545400000, + 'y': 1027 + }, + { + 'x': 1413546000000, + 'y': 1073 + }, + { + 'x': 1413546600000, + 'y': 992 + }, + { + 'x': 1413547200000, + 'y': 1005 + }, + { + 'x': 1413547800000, + 'y': 1014 + }, + { + 'x': 1413548400000, + 'y': 987 + }, + { + 'x': 1413549000000, + 'y': 982 + }, + { + 'x': 1413549600000, + 'y': 1086 + }, + { + 'x': 1413550200000, + 'y': 998 + }, + { + 'x': 1413550800000, + 'y': 935 + }, + { + 'x': 1413551400000, + 'y': 995 + }, + { + 'x': 1413552000000, + 'y': 926 + }, + { + 'x': 1413552600000, + 'y': 897 + }, + { + 'x': 1413553200000, + 'y': 873 + }, + { + 'x': 1413553800000, + 'y': 885 + }, + { + 'x': 1413554400000, + 'y': 859 + }, + { + 'x': 1413555000000, + 'y': 852 + }, + { + 'x': 1413555600000, + 'y': 779 + }, + { + 'x': 1413556200000, + 'y': 739 + }, + { + 'x': 1413556800000, + 'y': 783 + }, + { + 'x': 1413557400000, + 'y': 784 + }, + { + 'x': 1413558000000, + 'y': 687 + }, + { + 'x': 1413558600000, + 'y': 660 + }, + { + 'x': 1413559200000, + 'y': 672 + }, + { + 'x': 1413559800000, + 'y': 600 + }, + { + 'x': 1413560400000, + 'y': 659 + }, + { + 'x': 1413561000000, + 'y': 540 + }, + { + 'x': 1413561600000, + 'y': 539 + }, + { + 'x': 1413562200000, + 'y': 481 + }, + { + 'x': 1413562800000, + 'y': 498 + }, + { + 'x': 1413563400000, + 'y': 444 + }, + { + 'x': 1413564000000, + 'y': 452 + }, + { + 'x': 1413564600000, + 'y': 408 + }, + { + 'x': 1413565200000, + 'y': 358 + }, + { + 'x': 1413565800000, + 'y': 321 + }, + { + 'x': 1413566400000, + 'y': 305 + }, + { + 'x': 1413567000000, + 'y': 292 + }, + { + 'x': 1413567600000, + 'y': 289 + }, + { + 'x': 1413568200000, + 'y': 239 + }, + { + 'x': 1413568800000, + 'y': 256 + }, + { + 'x': 1413569400000, + 'y': 220 + }, + { + 'x': 1413570000000, + 'y': 205 + }, + { + 'x': 1413570600000, + 'y': 201 + }, + { + 'x': 1413571200000, + 'y': 183 + }, + { + 'x': 1413571800000, + 'y': 172 + }, + { + 'x': 1413572400000, + 'y': 73 + }, + { + 'x': 1413573600000, + 'y': 90 + }, + { + 'x': 1413574200000, + 'y': 130 + }, + { + 'x': 1413574800000, + 'y': 104 + }, + { + 'x': 1413575400000, + 'y': 108 + }, + { + 'x': 1413576000000, + 'y': 92 + }, + { + 'x': 1413576600000, + 'y': 79 + }, + { + 'x': 1413577200000, + 'y': 90 + }, + { + 'x': 1413577800000, + 'y': 72 + }, + { + 'x': 1413578400000, + 'y': 68 + }, + { + 'x': 1413579000000, + 'y': 52 + }, + { + 'x': 1413579600000, + 'y': 60 + }, + { + 'x': 1413580200000, + 'y': 51 + }, + { + 'x': 1413580800000, + 'y': 32 + }, + { + 'x': 1413581400000, + 'y': 37 + }, + { + 'x': 1413582000000, + 'y': 30 + }, + { + 'x': 1413582600000, + 'y': 29 + }, + { + 'x': 1413583200000, + 'y': 24 + }, + { + 'x': 1413583800000, + 'y': 16 + }, + { + 'x': 1413584400000, + 'y': 15 + }, + { + 'x': 1413585000000, + 'y': 15 + }, + { + 'x': 1413585600000, + 'y': 10 + }, + { + 'x': 1413586200000, + 'y': 9 + }, + { + 'x': 1413586800000, + 'y': 9 + } + ] + }, + { + 'label': 'png', + 'values': [ + { + 'x': 1413543600000, + 'y': 44 + }, + { + 'x': 1413544200000, + 'y': 495 + }, + { + 'x': 1413544800000, + 'y': 489 + }, + { + 'x': 1413545400000, + 'y': 492 + }, + { + 'x': 1413546000000, + 'y': 556 + }, + { + 'x': 1413546600000, + 'y': 536 + }, + { + 'x': 1413547200000, + 'y': 511 + }, + { + 'x': 1413547800000, + 'y': 479 + }, + { + 'x': 1413548400000, + 'y': 544 + }, + { + 'x': 1413549000000, + 'y': 513 + }, + { + 'x': 1413549600000, + 'y': 501 + }, + { + 'x': 1413550200000, + 'y': 532 + }, + { + 'x': 1413550800000, + 'y': 440 + }, + { + 'x': 1413551400000, + 'y': 455 + }, + { + 'x': 1413552000000, + 'y': 455 + }, + { + 'x': 1413552600000, + 'y': 471 + }, + { + 'x': 1413553200000, + 'y': 428 + }, + { + 'x': 1413553800000, + 'y': 457 + }, + { + 'x': 1413554400000, + 'y': 450 + }, + { + 'x': 1413555000000, + 'y': 418 + }, + { + 'x': 1413555600000, + 'y': 398 + }, + { + 'x': 1413556200000, + 'y': 397 + }, + { + 'x': 1413556800000, + 'y': 359 + }, + { + 'x': 1413557400000, + 'y': 398 + }, + { + 'x': 1413558000000, + 'y': 339 + }, + { + 'x': 1413558600000, + 'y': 363 + }, + { + 'x': 1413559200000, + 'y': 297 + }, + { + 'x': 1413559800000, + 'y': 323 + }, + { + 'x': 1413560400000, + 'y': 302 + }, + { + 'x': 1413561000000, + 'y': 260 + }, + { + 'x': 1413561600000, + 'y': 276 + }, + { + 'x': 1413562200000, + 'y': 249 + }, + { + 'x': 1413562800000, + 'y': 248 + }, + { + 'x': 1413563400000, + 'y': 235 + }, + { + 'x': 1413564000000, + 'y': 234 + }, + { + 'x': 1413564600000, + 'y': 188 + }, + { + 'x': 1413565200000, + 'y': 192 + }, + { + 'x': 1413565800000, + 'y': 173 + }, + { + 'x': 1413566400000, + 'y': 160 + }, + { + 'x': 1413567000000, + 'y': 137 + }, + { + 'x': 1413567600000, + 'y': 158 + }, + { + 'x': 1413568200000, + 'y': 111 + }, + { + 'x': 1413568800000, + 'y': 145 + }, + { + 'x': 1413569400000, + 'y': 118 + }, + { + 'x': 1413570000000, + 'y': 104 + }, + { + 'x': 1413570600000, + 'y': 80 + }, + { + 'x': 1413571200000, + 'y': 79 + }, + { + 'x': 1413571800000, + 'y': 86 + }, + { + 'x': 1413572400000, + 'y': 47 + }, + { + 'x': 1413573600000, + 'y': 49 + }, + { + 'x': 1413574200000, + 'y': 68 + }, + { + 'x': 1413574800000, + 'y': 78 + }, + { + 'x': 1413575400000, + 'y': 77 + }, + { + 'x': 1413576000000, + 'y': 50 + }, + { + 'x': 1413576600000, + 'y': 51 + }, + { + 'x': 1413577200000, + 'y': 40 + }, + { + 'x': 1413577800000, + 'y': 42 + }, + { + 'x': 1413578400000, + 'y': 29 + }, + { + 'x': 1413579000000, + 'y': 24 + }, + { + 'x': 1413579600000, + 'y': 30 + }, + { + 'x': 1413580200000, + 'y': 18 + }, + { + 'x': 1413580800000, + 'y': 15 + }, + { + 'x': 1413581400000, + 'y': 19 + }, + { + 'x': 1413582000000, + 'y': 18 + }, + { + 'x': 1413582600000, + 'y': 13 + }, + { + 'x': 1413583200000, + 'y': 11 + }, + { + 'x': 1413583800000, + 'y': 11 + }, + { + 'x': 1413584400000, + 'y': 13 + }, + { + 'x': 1413585000000, + 'y': 9 + }, + { + 'x': 1413585600000, + 'y': 9 + }, + { + 'x': 1413586200000, + 'y': 9 + }, + { + 'x': 1413586800000, + 'y': 3 + } + ] + }, + { + 'label': 'css', + 'values': [ + { + 'x': 1413543600000, + 'y': 35 + }, + { + 'x': 1413544200000, + 'y': 360 + }, + { + 'x': 1413544800000, + 'y': 343 + }, + { + 'x': 1413545400000, + 'y': 329 + }, + { + 'x': 1413546000000, + 'y': 345 + }, + { + 'x': 1413546600000, + 'y': 336 + }, + { + 'x': 1413547200000, + 'y': 330 + }, + { + 'x': 1413547800000, + 'y': 334 + }, + { + 'x': 1413548400000, + 'y': 326 + }, + { + 'x': 1413549000000, + 'y': 351 + }, + { + 'x': 1413549600000, + 'y': 334 + }, + { + 'x': 1413550200000, + 'y': 351 + }, + { + 'x': 1413550800000, + 'y': 337 + }, + { + 'x': 1413551400000, + 'y': 306 + }, + { + 'x': 1413552000000, + 'y': 346 + }, + { + 'x': 1413552600000, + 'y': 317 + }, + { + 'x': 1413553200000, + 'y': 298 + }, + { + 'x': 1413553800000, + 'y': 288 + }, + { + 'x': 1413554400000, + 'y': 283 + }, + { + 'x': 1413555000000, + 'y': 262 + }, + { + 'x': 1413555600000, + 'y': 245 + }, + { + 'x': 1413556200000, + 'y': 259 + }, + { + 'x': 1413556800000, + 'y': 267 + }, + { + 'x': 1413557400000, + 'y': 230 + }, + { + 'x': 1413558000000, + 'y': 218 + }, + { + 'x': 1413558600000, + 'y': 241 + }, + { + 'x': 1413559200000, + 'y': 213 + }, + { + 'x': 1413559800000, + 'y': 239 + }, + { + 'x': 1413560400000, + 'y': 208 + }, + { + 'x': 1413561000000, + 'y': 187 + }, + { + 'x': 1413561600000, + 'y': 166 + }, + { + 'x': 1413562200000, + 'y': 154 + }, + { + 'x': 1413562800000, + 'y': 184 + }, + { + 'x': 1413563400000, + 'y': 148 + }, + { + 'x': 1413564000000, + 'y': 153 + }, + { + 'x': 1413564600000, + 'y': 149 + }, + { + 'x': 1413565200000, + 'y': 102 + }, + { + 'x': 1413565800000, + 'y': 110 + }, + { + 'x': 1413566400000, + 'y': 121 + }, + { + 'x': 1413567000000, + 'y': 120 + }, + { + 'x': 1413567600000, + 'y': 86 + }, + { + 'x': 1413568200000, + 'y': 96 + }, + { + 'x': 1413568800000, + 'y': 71 + }, + { + 'x': 1413569400000, + 'y': 92 + }, + { + 'x': 1413570000000, + 'y': 65 + }, + { + 'x': 1413570600000, + 'y': 54 + }, + { + 'x': 1413571200000, + 'y': 68 + }, + { + 'x': 1413571800000, + 'y': 57 + }, + { + 'x': 1413572400000, + 'y': 33 + }, + { + 'x': 1413573600000, + 'y': 47 + }, + { + 'x': 1413574200000, + 'y': 42 + }, + { + 'x': 1413574800000, + 'y': 39 + }, + { + 'x': 1413575400000, + 'y': 25 + }, + { + 'x': 1413576000000, + 'y': 31 + }, + { + 'x': 1413576600000, + 'y': 37 + }, + { + 'x': 1413577200000, + 'y': 35 + }, + { + 'x': 1413577800000, + 'y': 19 + }, + { + 'x': 1413578400000, + 'y': 15 + }, + { + 'x': 1413579000000, + 'y': 21 + }, + { + 'x': 1413579600000, + 'y': 16 + }, + { + 'x': 1413580200000, + 'y': 18 + }, + { + 'x': 1413580800000, + 'y': 10 + }, + { + 'x': 1413581400000, + 'y': 13 + }, + { + 'x': 1413582000000, + 'y': 14 + }, + { + 'x': 1413582600000, + 'y': 11 + }, + { + 'x': 1413583200000, + 'y': 4 + }, + { + 'x': 1413583800000, + 'y': 6 + }, + { + 'x': 1413584400000, + 'y': 3 + }, + { + 'x': 1413585000000, + 'y': 6 + }, + { + 'x': 1413585600000, + 'y': 6 + }, + { + 'x': 1413586200000, + 'y': 2 + }, + { + 'x': 1413586800000, + 'y': 3 + } + ] + }, + { + 'label': 'gif', + 'values': [ + { + 'x': 1413543600000, + 'y': 21 + }, + { + 'x': 1413544200000, + 'y': 191 + }, + { + 'x': 1413544800000, + 'y': 176 + }, + { + 'x': 1413545400000, + 'y': 166 + }, + { + 'x': 1413546000000, + 'y': 183 + }, + { + 'x': 1413546600000, + 'y': 170 + }, + { + 'x': 1413547200000, + 'y': 153 + }, + { + 'x': 1413547800000, + 'y': 202 + }, + { + 'x': 1413548400000, + 'y': 175 + }, + { + 'x': 1413549000000, + 'y': 161 + }, + { + 'x': 1413549600000, + 'y': 174 + }, + { + 'x': 1413550200000, + 'y': 167 + }, + { + 'x': 1413550800000, + 'y': 171 + }, + { + 'x': 1413551400000, + 'y': 176 + }, + { + 'x': 1413552000000, + 'y': 139 + }, + { + 'x': 1413552600000, + 'y': 145 + }, + { + 'x': 1413553200000, + 'y': 157 + }, + { + 'x': 1413553800000, + 'y': 148 + }, + { + 'x': 1413554400000, + 'y': 149 + }, + { + 'x': 1413555000000, + 'y': 135 + }, + { + 'x': 1413555600000, + 'y': 118 + }, + { + 'x': 1413556200000, + 'y': 142 + }, + { + 'x': 1413556800000, + 'y': 141 + }, + { + 'x': 1413557400000, + 'y': 146 + }, + { + 'x': 1413558000000, + 'y': 114 + }, + { + 'x': 1413558600000, + 'y': 115 + }, + { + 'x': 1413559200000, + 'y': 136 + }, + { + 'x': 1413559800000, + 'y': 106 + }, + { + 'x': 1413560400000, + 'y': 92 + }, + { + 'x': 1413561000000, + 'y': 97 + }, + { + 'x': 1413561600000, + 'y': 90 + }, + { + 'x': 1413562200000, + 'y': 69 + }, + { + 'x': 1413562800000, + 'y': 66 + }, + { + 'x': 1413563400000, + 'y': 93 + }, + { + 'x': 1413564000000, + 'y': 75 + }, + { + 'x': 1413564600000, + 'y': 68 + }, + { + 'x': 1413565200000, + 'y': 55 + }, + { + 'x': 1413565800000, + 'y': 73 + }, + { + 'x': 1413566400000, + 'y': 57 + }, + { + 'x': 1413567000000, + 'y': 48 + }, + { + 'x': 1413567600000, + 'y': 41 + }, + { + 'x': 1413568200000, + 'y': 39 + }, + { + 'x': 1413568800000, + 'y': 32 + }, + { + 'x': 1413569400000, + 'y': 33 + }, + { + 'x': 1413570000000, + 'y': 39 + }, + { + 'x': 1413570600000, + 'y': 35 + }, + { + 'x': 1413571200000, + 'y': 25 + }, + { + 'x': 1413571800000, + 'y': 28 + }, + { + 'x': 1413572400000, + 'y': 8 + }, + { + 'x': 1413573600000, + 'y': 13 + }, + { + 'x': 1413574200000, + 'y': 23 + }, + { + 'x': 1413574800000, + 'y': 19 + }, + { + 'x': 1413575400000, + 'y': 16 + }, + { + 'x': 1413576000000, + 'y': 22 + }, + { + 'x': 1413576600000, + 'y': 13 + }, + { + 'x': 1413577200000, + 'y': 21 + }, + { + 'x': 1413577800000, + 'y': 11 + }, + { + 'x': 1413578400000, + 'y': 12 + }, + { + 'x': 1413579000000, + 'y': 10 + }, + { + 'x': 1413579600000, + 'y': 7 + }, + { + 'x': 1413580200000, + 'y': 4 + }, + { + 'x': 1413580800000, + 'y': 5 + }, + { + 'x': 1413581400000, + 'y': 7 + }, + { + 'x': 1413582000000, + 'y': 9 + }, + { + 'x': 1413582600000, + 'y': 2 + }, + { + 'x': 1413583200000, + 'y': 2 + }, + { + 'x': 1413583800000, + 'y': 4 + }, + { + 'x': 1413584400000, + 'y': 6 + }, + { + 'x': 1413585600000, + 'y': 2 + }, + { + 'x': 1413586200000, + 'y': 4 + }, + { + 'x': 1413586800000, + 'y': 4 + } + ] + } + ], + 'hits': 108970, + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/filters/_columns.js b/bin/fixtures/vislib/mock_data/filters/_columns.js new file mode 100644 index 00000000000000..ea5ab1b097070d --- /dev/null +++ b/bin/fixtures/vislib/mock_data/filters/_columns.js @@ -0,0 +1,106 @@ +var _ = require('lodash'); + +module.exports = { + 'columns': [ + { + 'label': 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 10379 + }, + { + 'x': 'png', + 'y': 6395 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 9253 + }, + { + 'x': 'png', + 'y': 5571 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 7740 + }, + { + 'x': 'png', + 'y': 4697 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 171443 +}; diff --git a/bin/fixtures/vislib/mock_data/filters/_rows.js b/bin/fixtures/vislib/mock_data/filters/_rows.js new file mode 100644 index 00000000000000..d3c27ed491b506 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/filters/_rows.js @@ -0,0 +1,106 @@ +var _ = require('lodash'); + +module.exports = { + 'rows': [ + { + 'label': '200: response', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 25260 + }, + { + 'x': 'png', + 'y': 15311 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '404: response', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 1352 + }, + { + 'x': 'png', + 'y': 826 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '503: response', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 761 + }, + { + 'x': 'png', + 'y': 527 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 171443 +}; diff --git a/bin/fixtures/vislib/mock_data/filters/_series.js b/bin/fixtures/vislib/mock_data/filters/_series.js new file mode 100644 index 00000000000000..46cdbbc3794a4a --- /dev/null +++ b/bin/fixtures/vislib/mock_data/filters/_series.js @@ -0,0 +1,40 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'xAxisLabel': 'filters', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'css', + 'y': 27374 + }, + { + 'x': 'html', + 'y': 0 + }, + { + 'x': 'png', + 'y': 16663 + } + ] + } + ], + 'hits': 171454, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/geohash/_columns.js b/bin/fixtures/vislib/mock_data/geohash/_columns.js new file mode 100644 index 00000000000000..2f39a449c95514 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/geohash/_columns.js @@ -0,0 +1,3744 @@ +var _ = require('lodash'); +module.exports = { + 'columns': [ + { + 'title': 'Top 2 geo.dest: CN', + 'valueFormatter': _.identity, + 'geoJson': { + 'type': 'FeatureCollection', + 'features': [ + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 22.5 + ] + }, + 'properties': { + 'value': 42, + 'geohash': 's', + 'center': [ + 22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 's', + 'value': 's', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 42, + 'value': 42, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 0 + ], + [ + 45, + 0 + ], + [ + 45, + 45 + ], + [ + 0, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 22.5 + ] + }, + 'properties': { + 'value': 31, + 'geohash': 'd', + 'center': [ + -67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'd', + 'value': 'd', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 31, + 'value': 31, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 0 + ], + [ + -45, + 0 + ], + [ + -45, + 45 + ], + [ + -90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 22.5 + ] + }, + 'properties': { + 'value': 30, + 'geohash': 'w', + 'center': [ + 112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'w', + 'value': 'w', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 30, + 'value': 30, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 0 + ], + [ + 135, + 0 + ], + [ + 135, + 45 + ], + [ + 90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 22.5 + ] + }, + 'properties': { + 'value': 25, + 'geohash': '9', + 'center': [ + -112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '9', + 'value': '9', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 25, + 'value': 25, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 0 + ], + [ + -90, + 0 + ], + [ + -90, + 45 + ], + [ + -135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 22.5 + ] + }, + 'properties': { + 'value': 22, + 'geohash': 't', + 'center': [ + 67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 't', + 'value': 't', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 22, + 'value': 22, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 0 + ], + [ + 90, + 0 + ], + [ + 90, + 45 + ], + [ + 45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + -22.5 + ] + }, + 'properties': { + 'value': 22, + 'geohash': 'k', + 'center': [ + 22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'k', + 'value': 'k', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 22, + 'value': 22, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -45 + ], + [ + 45, + -45 + ], + [ + 45, + 0 + ], + [ + 0, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -22.5 + ] + }, + 'properties': { + 'value': 21, + 'geohash': '6', + 'center': [ + -67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '6', + 'value': '6', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 21, + 'value': 21, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -45 + ], + [ + -45, + -45 + ], + [ + -45, + 0 + ], + [ + -90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 67.5 + ] + }, + 'properties': { + 'value': 19, + 'geohash': 'u', + 'center': [ + 22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'u', + 'value': 'u', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 19, + 'value': 19, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 45 + ], + [ + 45, + 45 + ], + [ + 45, + 90 + ], + [ + 0, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 67.5 + ] + }, + 'properties': { + 'value': 18, + 'geohash': 'v', + 'center': [ + 67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'v', + 'value': 'v', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 18, + 'value': 18, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 45 + ], + [ + 90, + 45 + ], + [ + 90, + 90 + ], + [ + 45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 67.5 + ] + }, + 'properties': { + 'value': 11, + 'geohash': 'c', + 'center': [ + -112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'c', + 'value': 'c', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 11, + 'value': 11, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 45 + ], + [ + -90, + 45 + ], + [ + -90, + 90 + ], + [ + -135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -22.5 + ] + }, + 'properties': { + 'value': 10, + 'geohash': 'r', + 'center': [ + 157.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'r', + 'value': 'r', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 10, + 'value': 10, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + -45 + ], + [ + 180, + -45 + ], + [ + 180, + 0 + ], + [ + 135, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 67.5 + ] + }, + 'properties': { + 'value': 9, + 'geohash': 'y', + 'center': [ + 112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'y', + 'value': 'y', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 9, + 'value': 9, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 45 + ], + [ + 135, + 45 + ], + [ + 135, + 90 + ], + [ + 90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 22.5 + ] + }, + 'properties': { + 'value': 9, + 'geohash': 'e', + 'center': [ + -22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'e', + 'value': 'e', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 9, + 'value': 9, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 45 + ], + [ + -45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 67.5 + ] + }, + 'properties': { + 'value': 8, + 'geohash': 'f', + 'center': [ + -67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'f', + 'value': 'f', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 8, + 'value': 8, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 45 + ], + [ + -45, + 45 + ], + [ + -45, + 90 + ], + [ + -90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -22.5 + ] + }, + 'properties': { + 'value': 8, + 'geohash': '7', + 'center': [ + -22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '7', + 'value': '7', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 8, + 'value': 8, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -45 + ], + [ + 0, + -45 + ], + [ + 0, + 0 + ], + [ + -45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + -22.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'q', + 'center': [ + 112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'q', + 'value': 'q', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + -45 + ], + [ + 135, + -45 + ], + [ + 135, + 0 + ], + [ + 90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'g', + 'center': [ + -22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'g', + 'value': 'g', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 45 + ], + [ + 0, + 45 + ], + [ + 0, + 90 + ], + [ + -45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 22.5 + ] + }, + 'properties': { + 'value': 4, + 'geohash': 'x', + 'center': [ + 157.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'x', + 'value': 'x', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 4, + 'value': 4, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 0 + ], + [ + 180, + 0 + ], + [ + 180, + 45 + ], + [ + 135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -157.5, + 67.5 + ] + }, + 'properties': { + 'value': 3, + 'geohash': 'b', + 'center': [ + -157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'b', + 'value': 'b', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 3, + 'value': 3, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -180, + 45 + ], + [ + -135, + 45 + ], + [ + -135, + 90 + ], + [ + -180, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': 'z', + 'center': [ + 157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'z', + 'value': 'z', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 45 + ], + [ + 180, + 45 + ], + [ + 180, + 90 + ], + [ + 135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'm', + 'center': [ + 67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'm', + 'value': 'm', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -45 + ], + [ + 90, + -45 + ], + [ + 90, + 0 + ], + [ + 45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '5', + 'center': [ + -22.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '5', + 'value': '5', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -90 + ], + [ + 0, + -90 + ], + [ + 0, + -45 + ], + [ + -45, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '4', + 'center': [ + -67.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '4', + 'value': '4', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -90 + ], + [ + -45, + -90 + ], + [ + -45, + -45 + ], + [ + -90, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '3', + 'center': [ + -112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '3', + 'value': '3', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + -45 + ], + [ + -90, + -45 + ], + [ + -90, + 0 + ], + [ + -135, + 0 + ] + ] + } + } + ], + 'properties': { + 'min': 1, + 'max': 42 + } + } + }, + { + 'label': 'Top 2 geo.dest: IN', + 'valueFormatter': _.identity, + 'geoJson': { + 'type': 'FeatureCollection', + 'features': [ + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 22.5 + ] + }, + 'properties': { + 'value': 32, + 'geohash': 's', + 'center': [ + 22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 's', + 'value': 's', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 32, + 'value': 32, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 0 + ], + [ + 45, + 0 + ], + [ + 45, + 45 + ], + [ + 0, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -22.5 + ] + }, + 'properties': { + 'value': 31, + 'geohash': '6', + 'center': [ + -67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '6', + 'value': '6', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 31, + 'value': 31, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -45 + ], + [ + -45, + -45 + ], + [ + -45, + 0 + ], + [ + -90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 22.5 + ] + }, + 'properties': { + 'value': 28, + 'geohash': 'd', + 'center': [ + -67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'd', + 'value': 'd', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 28, + 'value': 28, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 0 + ], + [ + -45, + 0 + ], + [ + -45, + 45 + ], + [ + -90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 22.5 + ] + }, + 'properties': { + 'value': 27, + 'geohash': 'w', + 'center': [ + 112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'w', + 'value': 'w', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 27, + 'value': 27, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 0 + ], + [ + 135, + 0 + ], + [ + 135, + 45 + ], + [ + 90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 22.5 + ] + }, + 'properties': { + 'value': 24, + 'geohash': 't', + 'center': [ + 67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 't', + 'value': 't', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 24, + 'value': 24, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 0 + ], + [ + 90, + 0 + ], + [ + 90, + 45 + ], + [ + 45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + -22.5 + ] + }, + 'properties': { + 'value': 23, + 'geohash': 'k', + 'center': [ + 22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'k', + 'value': 'k', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 23, + 'value': 23, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -45 + ], + [ + 45, + -45 + ], + [ + 45, + 0 + ], + [ + 0, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 67.5 + ] + }, + 'properties': { + 'value': 17, + 'geohash': 'u', + 'center': [ + 22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'u', + 'value': 'u', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 17, + 'value': 17, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 45 + ], + [ + 45, + 45 + ], + [ + 45, + 90 + ], + [ + 0, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 22.5 + ] + }, + 'properties': { + 'value': 16, + 'geohash': '9', + 'center': [ + -112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '9', + 'value': '9', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 16, + 'value': 16, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 0 + ], + [ + -90, + 0 + ], + [ + -90, + 45 + ], + [ + -135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 67.5 + ] + }, + 'properties': { + 'value': 14, + 'geohash': 'v', + 'center': [ + 67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'v', + 'value': 'v', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 14, + 'value': 14, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 45 + ], + [ + 90, + 45 + ], + [ + 90, + 90 + ], + [ + 45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 22.5 + ] + }, + 'properties': { + 'value': 13, + 'geohash': 'e', + 'center': [ + -22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'e', + 'value': 'e', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 13, + 'value': 13, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 45 + ], + [ + -45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -22.5 + ] + }, + 'properties': { + 'value': 9, + 'geohash': 'r', + 'center': [ + 157.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'r', + 'value': 'r', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 9, + 'value': 9, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + -45 + ], + [ + 180, + -45 + ], + [ + 180, + 0 + ], + [ + 135, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'y', + 'center': [ + 112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'y', + 'value': 'y', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 45 + ], + [ + 135, + 45 + ], + [ + 135, + 90 + ], + [ + 90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'g', + 'center': [ + -22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'g', + 'value': 'g', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 45 + ], + [ + 0, + 45 + ], + [ + 0, + 90 + ], + [ + -45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'f', + 'center': [ + -67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'f', + 'value': 'f', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 45 + ], + [ + -45, + 45 + ], + [ + -45, + 90 + ], + [ + -90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 67.5 + ] + }, + 'properties': { + 'value': 5, + 'geohash': 'c', + 'center': [ + -112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'c', + 'value': 'c', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 5, + 'value': 5, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 45 + ], + [ + -90, + 45 + ], + [ + -90, + 90 + ], + [ + -135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -157.5, + 67.5 + ] + }, + 'properties': { + 'value': 4, + 'geohash': 'b', + 'center': [ + -157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'b', + 'value': 'b', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 4, + 'value': 4, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -180, + 45 + ], + [ + -135, + 45 + ], + [ + -135, + 90 + ], + [ + -180, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + -22.5 + ] + }, + 'properties': { + 'value': 3, + 'geohash': 'q', + 'center': [ + 112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'q', + 'value': 'q', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 3, + 'value': 3, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + -45 + ], + [ + 135, + -45 + ], + [ + 135, + 0 + ], + [ + 90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': '4', + 'center': [ + -67.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '4', + 'value': '4', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -90 + ], + [ + -45, + -90 + ], + [ + -45, + -45 + ], + [ + -90, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'z', + 'center': [ + 157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'z', + 'value': 'z', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 45 + ], + [ + 180, + 45 + ], + [ + 180, + 90 + ], + [ + 135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'x', + 'center': [ + 157.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'x', + 'value': 'x', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 0 + ], + [ + 180, + 0 + ], + [ + 180, + 45 + ], + [ + 135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'p', + 'center': [ + 157.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'p', + 'value': 'p', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + -90 + ], + [ + 180, + -90 + ], + [ + 180, + -45 + ], + [ + 135, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'm', + 'center': [ + 67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': 'm', + 'value': 'm', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -45 + ], + [ + 90, + -45 + ], + [ + 90, + 0 + ], + [ + 45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '7', + 'center': [ + -22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': false + } + }, + 'type': 'bucket' + }, + 'key': '7', + 'value': '7', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -45 + ], + [ + 0, + -45 + ], + [ + 0, + 0 + ], + [ + -45, + 0 + ] + ] + } + } + ], + 'properties': { + 'min': 1, + 'max': 32 + } + } + } + ] +}; diff --git a/bin/fixtures/vislib/mock_data/geohash/_geo_json.js b/bin/fixtures/vislib/mock_data/geohash/_geo_json.js new file mode 100644 index 00000000000000..ac84284a1a78ae --- /dev/null +++ b/bin/fixtures/vislib/mock_data/geohash/_geo_json.js @@ -0,0 +1,1846 @@ +var _ = require('lodash'); + +module.exports = { + 'valueFormatter': _.identity, + 'geoJson': { + 'type': 'FeatureCollection', + 'features': [ + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 22.5 + ] + }, + 'properties': { + 'value': 608, + 'geohash': 's', + 'center': [ + 22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 's', + 'value': 's', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 608, + 'value': 608, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 0 + ], + [ + 0, + 45 + ], + [ + 45, + 45 + ], + [ + 45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 22.5 + ] + }, + 'properties': { + 'value': 522, + 'geohash': 'w', + 'center': [ + 112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'w', + 'value': 'w', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 522, + 'value': 522, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 90 + ], + [ + 0, + 135 + ], + [ + 45, + 135 + ], + [ + 45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -22.5 + ] + }, + 'properties': { + 'value': 517, + 'geohash': '6', + 'center': [ + -67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '6', + 'value': '6', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 517, + 'value': 517, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -90 + ], + [ + -45, + -45 + ], + [ + 0, + -45 + ], + [ + 0, + -90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 22.5 + ] + }, + 'properties': { + 'value': 446, + 'geohash': 'd', + 'center': [ + -67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'd', + 'value': 'd', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 446, + 'value': 446, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -90 + ], + [ + 0, + -45 + ], + [ + 45, + -45 + ], + [ + 45, + -90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 67.5 + ] + }, + 'properties': { + 'value': 426, + 'geohash': 'u', + 'center': [ + 22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'u', + 'value': 'u', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 426, + 'value': 426, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 0 + ], + [ + 45, + 45 + ], + [ + 90, + 45 + ], + [ + 90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 22.5 + ] + }, + 'properties': { + 'value': 413, + 'geohash': 't', + 'center': [ + 67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 't', + 'value': 't', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 413, + 'value': 413, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 45 + ], + [ + 0, + 90 + ], + [ + 45, + 90 + ], + [ + 45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + -22.5 + ] + }, + 'properties': { + 'value': 362, + 'geohash': 'k', + 'center': [ + 22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'k', + 'value': 'k', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 362, + 'value': 362, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 0 + ], + [ + -45, + 45 + ], + [ + 0, + 45 + ], + [ + 0, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 22.5 + ] + }, + 'properties': { + 'value': 352, + 'geohash': '9', + 'center': [ + -112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '9', + 'value': '9', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 352, + 'value': 352, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -135 + ], + [ + 0, + -90 + ], + [ + 45, + -90 + ], + [ + 45, + -135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 22.5 + ] + }, + 'properties': { + 'value': 216, + 'geohash': 'e', + 'center': [ + -22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'e', + 'value': 'e', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 216, + 'value': 216, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -45 + ], + [ + 0, + 0 + ], + [ + 45, + 0 + ], + [ + 45, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 67.5 + ] + }, + 'properties': { + 'value': 183, + 'geohash': 'v', + 'center': [ + 67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'v', + 'value': 'v', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 183, + 'value': 183, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 45 + ], + [ + 45, + 90 + ], + [ + 90, + 90 + ], + [ + 90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -22.5 + ] + }, + 'properties': { + 'value': 158, + 'geohash': 'r', + 'center': [ + 157.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'r', + 'value': 'r', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 158, + 'value': 158, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 135 + ], + [ + -45, + 180 + ], + [ + 0, + 180 + ], + [ + 0, + 135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 67.5 + ] + }, + 'properties': { + 'value': 139, + 'geohash': 'y', + 'center': [ + 112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'y', + 'value': 'y', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 139, + 'value': 139, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 90 + ], + [ + 45, + 135 + ], + [ + 90, + 135 + ], + [ + 90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 67.5 + ] + }, + 'properties': { + 'value': 110, + 'geohash': 'c', + 'center': [ + -112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'c', + 'value': 'c', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 110, + 'value': 110, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -135 + ], + [ + 45, + -90 + ], + [ + 90, + -90 + ], + [ + 90, + -135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + -22.5 + ] + }, + 'properties': { + 'value': 101, + 'geohash': 'q', + 'center': [ + 112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'q', + 'value': 'q', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 101, + 'value': 101, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 90 + ], + [ + -45, + 135 + ], + [ + 0, + 135 + ], + [ + 0, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -22.5 + ] + }, + 'properties': { + 'value': 101, + 'geohash': '7', + 'center': [ + -22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '7', + 'value': '7', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 101, + 'value': 101, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -45 + ], + [ + -45, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 67.5 + ] + }, + 'properties': { + 'value': 92, + 'geohash': 'f', + 'center': [ + -67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'f', + 'value': 'f', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 92, + 'value': 92, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -90 + ], + [ + 45, + -45 + ], + [ + 90, + -45 + ], + [ + 90, + -90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -157.5, + 67.5 + ] + }, + 'properties': { + 'value': 75, + 'geohash': 'b', + 'center': [ + -157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'b', + 'value': 'b', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 75, + 'value': 75, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -180 + ], + [ + 45, + -135 + ], + [ + 90, + -135 + ], + [ + 90, + -180 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 67.5 + ] + }, + 'properties': { + 'value': 64, + 'geohash': 'g', + 'center': [ + -22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'g', + 'value': 'g', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 64, + 'value': 64, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -45 + ], + [ + 45, + 0 + ], + [ + 90, + 0 + ], + [ + 90, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 67.5 + ] + }, + 'properties': { + 'value': 36, + 'geohash': 'z', + 'center': [ + 157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'z', + 'value': 'z', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 36, + 'value': 36, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 135 + ], + [ + 45, + 180 + ], + [ + 90, + 180 + ], + [ + 90, + 135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 22.5 + ] + }, + 'properties': { + 'value': 34, + 'geohash': 'x', + 'center': [ + 157.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'x', + 'value': 'x', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 34, + 'value': 34, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 135 + ], + [ + 0, + 180 + ], + [ + 45, + 180 + ], + [ + 45, + 135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -67.5 + ] + }, + 'properties': { + 'value': 30, + 'geohash': '4', + 'center': [ + -67.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '4', + 'value': '4', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 30, + 'value': 30, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -90 + ], + [ + -90, + -45 + ], + [ + -45, + -45 + ], + [ + -45, + -90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + -22.5 + ] + }, + 'properties': { + 'value': 16, + 'geohash': 'm', + 'center': [ + 67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'm', + 'value': 'm', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 16, + 'value': 16, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 45 + ], + [ + -45, + 90 + ], + [ + 0, + 90 + ], + [ + 0, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -67.5 + ] + }, + 'properties': { + 'value': 10, + 'geohash': '5', + 'center': [ + -22.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '5', + 'value': '5', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 10, + 'value': 10, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -45 + ], + [ + -90, + 0 + ], + [ + -45, + 0 + ], + [ + -45, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'p', + 'center': [ + 157.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'p', + 'value': 'p', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 135 + ], + [ + -90, + 180 + ], + [ + -45, + 180 + ], + [ + -45, + 135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -157.5, + -22.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': '2', + 'center': [ + -157.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '2', + 'value': '2', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -180 + ], + [ + -45, + -135 + ], + [ + 0, + -135 + ], + [ + 0, + -180 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + -67.5 + ] + }, + 'properties': { + 'value': 4, + 'geohash': 'h', + 'center': [ + 22.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'h', + 'value': 'h', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 4, + 'value': 4, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 0 + ], + [ + -90, + 45 + ], + [ + -45, + 45 + ], + [ + -45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + -67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': 'n', + 'center': [ + 112.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'n', + 'value': 'n', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 90 + ], + [ + -90, + 135 + ], + [ + -45, + 135 + ], + [ + -45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + -67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': 'j', + 'center': [ + 67.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': 'j', + 'value': 'j', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 45 + ], + [ + -90, + 90 + ], + [ + -45, + 90 + ], + [ + -45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '3', + 'center': [ + -112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '3', + 'value': '3', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -135 + ], + [ + -45, + -90 + ], + [ + 0, + -90 + ], + [ + 0, + -135 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + -67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '1', + 'center': [ + -112.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + 'key': '1', + 'value': '1', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -135 + ], + [ + -90, + -90 + ], + [ + -45, + -90 + ], + [ + -45, + -135 + ] + ] + } + } + ], + 'properties': { + 'min': 1, + 'max': 608, + 'zoom': 2, + 'center': [5, 15] + } + }, +}; diff --git a/bin/fixtures/vislib/mock_data/geohash/_rows.js b/bin/fixtures/vislib/mock_data/geohash/_rows.js new file mode 100644 index 00000000000000..e0e1e6e7560c1c --- /dev/null +++ b/bin/fixtures/vislib/mock_data/geohash/_rows.js @@ -0,0 +1,3667 @@ +var _ = require('lodash'); + +module.exports = { + 'rows': [ + { + 'title': 'Top 2 geo.dest: CN', + 'valueFormatter': _.identity, + 'geoJson': { + 'type': 'FeatureCollection', + 'features': [ + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 22.5 + ] + }, + 'properties': { + 'value': 39, + 'geohash': 's', + 'center': [ + 22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 's', + 'value': 's', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 39, + 'value': 39, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 0 + ], + [ + 45, + 0 + ], + [ + 45, + 45 + ], + [ + 0, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 22.5 + ] + }, + 'properties': { + 'value': 31, + 'geohash': 'w', + 'center': [ + 112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'w', + 'value': 'w', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 31, + 'value': 31, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 0 + ], + [ + 135, + 0 + ], + [ + 135, + 45 + ], + [ + 90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 22.5 + ] + }, + 'properties': { + 'value': 30, + 'geohash': 'd', + 'center': [ + -67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'd', + 'value': 'd', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 30, + 'value': 30, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 0 + ], + [ + -45, + 0 + ], + [ + -45, + 45 + ], + [ + -90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 22.5 + ] + }, + 'properties': { + 'value': 25, + 'geohash': '9', + 'center': [ + -112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '9', + 'value': '9', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 25, + 'value': 25, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 0 + ], + [ + -90, + 0 + ], + [ + -90, + 45 + ], + [ + -135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 22.5 + ] + }, + 'properties': { + 'value': 23, + 'geohash': 't', + 'center': [ + 67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 't', + 'value': 't', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 23, + 'value': 23, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 0 + ], + [ + 90, + 0 + ], + [ + 90, + 45 + ], + [ + 45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + -22.5 + ] + }, + 'properties': { + 'value': 23, + 'geohash': 'k', + 'center': [ + 22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'k', + 'value': 'k', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 23, + 'value': 23, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -45 + ], + [ + 45, + -45 + ], + [ + 45, + 0 + ], + [ + 0, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -22.5 + ] + }, + 'properties': { + 'value': 22, + 'geohash': '6', + 'center': [ + -67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '6', + 'value': '6', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 22, + 'value': 22, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -45 + ], + [ + -45, + -45 + ], + [ + -45, + 0 + ], + [ + -90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 67.5 + ] + }, + 'properties': { + 'value': 20, + 'geohash': 'u', + 'center': [ + 22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'u', + 'value': 'u', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 20, + 'value': 20, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 45 + ], + [ + 45, + 45 + ], + [ + 45, + 90 + ], + [ + 0, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 67.5 + ] + }, + 'properties': { + 'value': 18, + 'geohash': 'v', + 'center': [ + 67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'v', + 'value': 'v', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 18, + 'value': 18, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 45 + ], + [ + 90, + 45 + ], + [ + 90, + 90 + ], + [ + 45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -22.5 + ] + }, + 'properties': { + 'value': 11, + 'geohash': 'r', + 'center': [ + 157.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'r', + 'value': 'r', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 11, + 'value': 11, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + -45 + ], + [ + 180, + -45 + ], + [ + 180, + 0 + ], + [ + 135, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 22.5 + ] + }, + 'properties': { + 'value': 11, + 'geohash': 'e', + 'center': [ + -22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'e', + 'value': 'e', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 11, + 'value': 11, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 45 + ], + [ + -45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 67.5 + ] + }, + 'properties': { + 'value': 10, + 'geohash': 'y', + 'center': [ + 112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'y', + 'value': 'y', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 10, + 'value': 10, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 45 + ], + [ + 135, + 45 + ], + [ + 135, + 90 + ], + [ + 90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 67.5 + ] + }, + 'properties': { + 'value': 10, + 'geohash': 'c', + 'center': [ + -112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'c', + 'value': 'c', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 10, + 'value': 10, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 45 + ], + [ + -90, + 45 + ], + [ + -90, + 90 + ], + [ + -135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 67.5 + ] + }, + 'properties': { + 'value': 8, + 'geohash': 'f', + 'center': [ + -67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'f', + 'value': 'f', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 8, + 'value': 8, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 45 + ], + [ + -45, + 45 + ], + [ + -45, + 90 + ], + [ + -90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -22.5 + ] + }, + 'properties': { + 'value': 8, + 'geohash': '7', + 'center': [ + -22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '7', + 'value': '7', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 8, + 'value': 8, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -45 + ], + [ + 0, + -45 + ], + [ + 0, + 0 + ], + [ + -45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + -22.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'q', + 'center': [ + 112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'q', + 'value': 'q', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + -45 + ], + [ + 135, + -45 + ], + [ + 135, + 0 + ], + [ + 90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'g', + 'center': [ + -22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'g', + 'value': 'g', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 45 + ], + [ + 0, + 45 + ], + [ + 0, + 90 + ], + [ + -45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 22.5 + ] + }, + 'properties': { + 'value': 4, + 'geohash': 'x', + 'center': [ + 157.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'x', + 'value': 'x', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 4, + 'value': 4, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 0 + ], + [ + 180, + 0 + ], + [ + 180, + 45 + ], + [ + 135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -157.5, + 67.5 + ] + }, + 'properties': { + 'value': 3, + 'geohash': 'b', + 'center': [ + -157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'b', + 'value': 'b', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 3, + 'value': 3, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -180, + 45 + ], + [ + -135, + 45 + ], + [ + -135, + 90 + ], + [ + -180, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': 'z', + 'center': [ + 157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'z', + 'value': 'z', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 45 + ], + [ + 180, + 45 + ], + [ + 180, + 90 + ], + [ + 135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': '4', + 'center': [ + -67.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '4', + 'value': '4', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -90 + ], + [ + -45, + -90 + ], + [ + -45, + -45 + ], + [ + -90, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '5', + 'center': [ + -22.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '5', + 'value': '5', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -90 + ], + [ + 0, + -90 + ], + [ + 0, + -45 + ], + [ + -45, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '3', + 'center': [ + -112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'CN', + 'value': 'CN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '3', + 'value': '3', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + -45 + ], + [ + -90, + -45 + ], + [ + -90, + 0 + ], + [ + -135, + 0 + ] + ] + } + } + ], + 'properties': { + 'min': 1, + 'max': 39 + } + } + }, + { + 'label': 'Top 2 geo.dest: IN', + 'valueFormatter': _.identity, + 'geoJson': { + 'type': 'FeatureCollection', + 'features': [ + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -22.5 + ] + }, + 'properties': { + 'value': 31, + 'geohash': '6', + 'center': [ + -67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '6', + 'value': '6', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 31, + 'value': 31, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -45 + ], + [ + -45, + -45 + ], + [ + -45, + 0 + ], + [ + -90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 22.5 + ] + }, + 'properties': { + 'value': 30, + 'geohash': 's', + 'center': [ + 22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 's', + 'value': 's', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 30, + 'value': 30, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 0 + ], + [ + 45, + 0 + ], + [ + 45, + 45 + ], + [ + 0, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 22.5 + ] + }, + 'properties': { + 'value': 29, + 'geohash': 'w', + 'center': [ + 112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'w', + 'value': 'w', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 29, + 'value': 29, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 0 + ], + [ + 135, + 0 + ], + [ + 135, + 45 + ], + [ + 90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 22.5 + ] + }, + 'properties': { + 'value': 28, + 'geohash': 'd', + 'center': [ + -67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'd', + 'value': 'd', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 28, + 'value': 28, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 0 + ], + [ + -45, + 0 + ], + [ + -45, + 45 + ], + [ + -90, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 22.5 + ] + }, + 'properties': { + 'value': 25, + 'geohash': 't', + 'center': [ + 67.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 't', + 'value': 't', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 25, + 'value': 25, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 0 + ], + [ + 90, + 0 + ], + [ + 90, + 45 + ], + [ + 45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + -22.5 + ] + }, + 'properties': { + 'value': 24, + 'geohash': 'k', + 'center': [ + 22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'k', + 'value': 'k', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 24, + 'value': 24, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + -45 + ], + [ + 45, + -45 + ], + [ + 45, + 0 + ], + [ + 0, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 22.5, + 67.5 + ] + }, + 'properties': { + 'value': 20, + 'geohash': 'u', + 'center': [ + 22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'u', + 'value': 'u', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 20, + 'value': 20, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 0, + 45 + ], + [ + 45, + 45 + ], + [ + 45, + 90 + ], + [ + 0, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 22.5 + ] + }, + 'properties': { + 'value': 18, + 'geohash': '9', + 'center': [ + -112.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '9', + 'value': '9', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 18, + 'value': 18, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 0 + ], + [ + -90, + 0 + ], + [ + -90, + 45 + ], + [ + -135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + 67.5 + ] + }, + 'properties': { + 'value': 14, + 'geohash': 'v', + 'center': [ + 67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'v', + 'value': 'v', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 14, + 'value': 14, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + 45 + ], + [ + 90, + 45 + ], + [ + 90, + 90 + ], + [ + 45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 22.5 + ] + }, + 'properties': { + 'value': 11, + 'geohash': 'e', + 'center': [ + -22.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'e', + 'value': 'e', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 11, + 'value': 11, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 0 + ], + [ + 0, + 0 + ], + [ + 0, + 45 + ], + [ + -45, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -22.5 + ] + }, + 'properties': { + 'value': 9, + 'geohash': 'r', + 'center': [ + 157.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'r', + 'value': 'r', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 9, + 'value': 9, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + -45 + ], + [ + 180, + -45 + ], + [ + 180, + 0 + ], + [ + 135, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'y', + 'center': [ + 112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'y', + 'value': 'y', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + 45 + ], + [ + 135, + 45 + ], + [ + 135, + 90 + ], + [ + 90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + 67.5 + ] + }, + 'properties': { + 'value': 6, + 'geohash': 'f', + 'center': [ + -67.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'f', + 'value': 'f', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 6, + 'value': 6, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + 45 + ], + [ + -45, + 45 + ], + [ + -45, + 90 + ], + [ + -90, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + 67.5 + ] + }, + 'properties': { + 'value': 5, + 'geohash': 'g', + 'center': [ + -22.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'g', + 'value': 'g', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 5, + 'value': 5, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + 45 + ], + [ + 0, + 45 + ], + [ + 0, + 90 + ], + [ + -45, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -112.5, + 67.5 + ] + }, + 'properties': { + 'value': 5, + 'geohash': 'c', + 'center': [ + -112.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'c', + 'value': 'c', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 5, + 'value': 5, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -135, + 45 + ], + [ + -90, + 45 + ], + [ + -90, + 90 + ], + [ + -135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -157.5, + 67.5 + ] + }, + 'properties': { + 'value': 4, + 'geohash': 'b', + 'center': [ + -157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'b', + 'value': 'b', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 4, + 'value': 4, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -180, + 45 + ], + [ + -135, + 45 + ], + [ + -135, + 90 + ], + [ + -180, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 112.5, + -22.5 + ] + }, + 'properties': { + 'value': 3, + 'geohash': 'q', + 'center': [ + 112.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'q', + 'value': 'q', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 3, + 'value': 3, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 90, + -45 + ], + [ + 135, + -45 + ], + [ + 135, + 0 + ], + [ + 90, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -67.5, + -67.5 + ] + }, + 'properties': { + 'value': 2, + 'geohash': '4', + 'center': [ + -67.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '4', + 'value': '4', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 2, + 'value': 2, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -90, + -90 + ], + [ + -45, + -90 + ], + [ + -45, + -45 + ], + [ + -90, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'z', + 'center': [ + 157.5, + 67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'z', + 'value': 'z', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 45 + ], + [ + 180, + 45 + ], + [ + 180, + 90 + ], + [ + 135, + 90 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + 22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'x', + 'center': [ + 157.5, + 22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'x', + 'value': 'x', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + 0 + ], + [ + 180, + 0 + ], + [ + 180, + 45 + ], + [ + 135, + 45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 157.5, + -67.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'p', + 'center': [ + 157.5, + -67.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'p', + 'value': 'p', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 135, + -90 + ], + [ + 180, + -90 + ], + [ + 180, + -45 + ], + [ + 135, + -45 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + 67.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': 'm', + 'center': [ + 67.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': 'm', + 'value': 'm', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + 45, + -45 + ], + [ + 90, + -45 + ], + [ + 90, + 0 + ], + [ + 45, + 0 + ] + ] + } + }, + { + 'type': 'Feature', + 'geometry': { + 'type': 'Point', + 'coordinates': [ + -22.5, + -22.5 + ] + }, + 'properties': { + 'value': 1, + 'geohash': '7', + 'center': [ + -22.5, + -22.5 + ], + 'aggConfigResult': { + '$parent': { + '$parent': { + '$parent': null, + 'key': 'IN', + 'value': 'IN', + 'aggConfig': { + 'id': '3', + 'type': 'terms', + 'schema': 'split', + 'params': { + 'field': 'geo.dest', + 'size': 2, + 'order': 'desc', + 'orderBy': '1', + 'row': true + } + }, + 'type': 'bucket' + }, + 'key': '7', + 'value': '7', + 'aggConfig': { + 'id': '2', + 'type': 'geohash_grid', + 'schema': 'segment', + 'params': { + 'field': 'geo.coordinates', + 'precision': 1 + } + }, + 'type': 'bucket' + }, + 'key': 1, + 'value': 1, + 'aggConfig': { + 'id': '1', + 'type': 'count', + 'schema': 'metric', + 'params': {} + }, + 'type': 'metric' + }, + 'rectangle': [ + [ + -45, + -45 + ], + [ + 0, + -45 + ], + [ + 0, + 0 + ], + [ + -45, + 0 + ] + ] + } + } + ], + 'properties': { + 'min': 1, + 'max': 31 + } + } + } + ], + 'hits': 1639 +}; diff --git a/bin/fixtures/vislib/mock_data/histogram/_columns.js b/bin/fixtures/vislib/mock_data/histogram/_columns.js new file mode 100644 index 00000000000000..aa022fefa2a05e --- /dev/null +++ b/bin/fixtures/vislib/mock_data/histogram/_columns.js @@ -0,0 +1,346 @@ +var _ = require('lodash'); + +module.exports = { + 'columns': [ + { + 'label': '404: response', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 2147483600, + 'y': 1, + 'y0': 0 + }, + { + 'x': 3221225400, + 'y': 0, + 'y0': 0 + }, + { + 'x': 4294967200, + 'y': 0, + 'y0': 0 + }, + { + 'x': 5368709100, + 'y': 0, + 'y0': 0 + }, + { + 'x': 6442450900, + 'y': 0, + 'y0': 0 + }, + { + 'x': 7516192700, + 'y': 0, + 'y0': 0 + }, + { + 'x': 8589934500, + 'y': 0, + 'y0': 0 + }, + { + 'x': 10737418200, + 'y': 0, + 'y0': 0 + }, + { + 'x': 11811160000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 12884901800, + 'y': 1, + 'y0': 0 + }, + { + 'x': 13958643700, + 'y': 0, + 'y0': 0 + }, + { + 'x': 15032385500, + 'y': 0, + 'y0': 0 + }, + { + 'x': 16106127300, + 'y': 0, + 'y0': 0 + }, + { + 'x': 18253611000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 19327352800, + 'y': 0, + 'y0': 0 + }, + { + 'x': 20401094600, + 'y': 0, + 'y0': 0 + }, + { + 'x': 21474836400, + 'y': 0, + 'y0': 0 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '200: response', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 2147483600, + 'y': 0, + 'y0': 0 + }, + { + 'x': 3221225400, + 'y': 2, + 'y0': 0 + }, + { + 'x': 4294967200, + 'y': 3, + 'y0': 0 + }, + { + 'x': 5368709100, + 'y': 3, + 'y0': 0 + }, + { + 'x': 6442450900, + 'y': 1, + 'y0': 0 + }, + { + 'x': 7516192700, + 'y': 1, + 'y0': 0 + }, + { + 'x': 8589934500, + 'y': 4, + 'y0': 0 + }, + { + 'x': 10737418200, + 'y': 0, + 'y0': 0 + }, + { + 'x': 11811160000, + 'y': 1, + 'y0': 0 + }, + { + 'x': 12884901800, + 'y': 1, + 'y0': 0 + }, + { + 'x': 13958643700, + 'y': 1, + 'y0': 0 + }, + { + 'x': 15032385500, + 'y': 2, + 'y0': 0 + }, + { + 'x': 16106127300, + 'y': 3, + 'y0': 0 + }, + { + 'x': 18253611000, + 'y': 4, + 'y0': 0 + }, + { + 'x': 19327352800, + 'y': 5, + 'y0': 0 + }, + { + 'x': 20401094600, + 'y': 2, + 'y0': 0 + }, + { + 'x': 21474836400, + 'y': 2, + 'y0': 0 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '503: response', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 2147483600, + 'y': 0, + 'y0': 0 + }, + { + 'x': 3221225400, + 'y': 0, + 'y0': 0 + }, + { + 'x': 4294967200, + 'y': 0, + 'y0': 0 + }, + { + 'x': 5368709100, + 'y': 0, + 'y0': 0 + }, + { + 'x': 6442450900, + 'y': 0, + 'y0': 0 + }, + { + 'x': 7516192700, + 'y': 0, + 'y0': 0 + }, + { + 'x': 8589934500, + 'y': 0, + 'y0': 0 + }, + { + 'x': 10737418200, + 'y': 1, + 'y0': 0 + }, + { + 'x': 11811160000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 12884901800, + 'y': 0, + 'y0': 0 + }, + { + 'x': 13958643700, + 'y': 0, + 'y0': 0 + }, + { + 'x': 15032385500, + 'y': 0, + 'y0': 0 + }, + { + 'x': 16106127300, + 'y': 0, + 'y0': 0 + }, + { + 'x': 18253611000, + 'y': 0, + 'y0': 0 + }, + { + 'x': 19327352800, + 'y': 0, + 'y0': 0 + }, + { + 'x': 20401094600, + 'y': 0, + 'y0': 0 + }, + { + 'x': 21474836400, + 'y': 0, + 'y0': 0 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 40 +}; diff --git a/bin/fixtures/vislib/mock_data/histogram/_rows.js b/bin/fixtures/vislib/mock_data/histogram/_rows.js new file mode 100644 index 00000000000000..bf15c31b9ceb5e --- /dev/null +++ b/bin/fixtures/vislib/mock_data/histogram/_rows.js @@ -0,0 +1,187 @@ +var _ = require('lodash'); + +module.exports = { + 'rows': [ + { + 'label': '404: response', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 2147483600, + 'y': 1 + }, + { + 'x': 10737418200, + 'y': 1 + }, + { + 'x': 15032385500, + 'y': 2 + }, + { + 'x': 19327352800, + 'y': 1 + }, + { + 'x': 32212254700, + 'y': 1 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '200: response', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 3221225400, + 'y': 4 + }, + { + 'x': 4294967200, + 'y': 3 + }, + { + 'x': 5368709100, + 'y': 3 + }, + { + 'x': 6442450900, + 'y': 2 + }, + { + 'x': 7516192700, + 'y': 2 + }, + { + 'x': 8589934500, + 'y': 2 + }, + { + 'x': 9663676400, + 'y': 3 + }, + { + 'x': 11811160000, + 'y': 3 + }, + { + 'x': 12884901800, + 'y': 2 + }, + { + 'x': 13958643700, + 'y': 1 + }, + { + 'x': 15032385500, + 'y': 2 + }, + { + 'x': 16106127300, + 'y': 3 + }, + { + 'x': 17179869100, + 'y': 1 + }, + { + 'x': 18253611000, + 'y': 4 + }, + { + 'x': 19327352800, + 'y': 1 + }, + { + 'x': 20401094600, + 'y': 1 + }, + { + 'x': 21474836400, + 'y': 4 + }, + { + 'x': 32212254700, + 'y': 3 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '503: response', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 10737418200, + 'y': 1 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 51 +}; diff --git a/bin/fixtures/vislib/mock_data/histogram/_series.js b/bin/fixtures/vislib/mock_data/histogram/_series.js new file mode 100644 index 00000000000000..6eb3d10b12b219 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/histogram/_series.js @@ -0,0 +1,103 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'xAxisLabel': 'machine.ram', + 'ordered': { + 'interval': 100 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 3221225400, + 'y': 5 + }, + { + 'x': 4294967200, + 'y': 2 + }, + { + 'x': 5368709100, + 'y': 5 + }, + { + 'x': 6442450900, + 'y': 4 + }, + { + 'x': 7516192700, + 'y': 1 + }, + { + 'x': 9663676400, + 'y': 9 + }, + { + 'x': 10737418200, + 'y': 5 + }, + { + 'x': 11811160000, + 'y': 5 + }, + { + 'x': 12884901800, + 'y': 2 + }, + { + 'x': 13958643700, + 'y': 3 + }, + { + 'x': 15032385500, + 'y': 3 + }, + { + 'x': 16106127300, + 'y': 3 + }, + { + 'x': 17179869100, + 'y': 1 + }, + { + 'x': 18253611000, + 'y': 6 + }, + { + 'x': 19327352800, + 'y': 3 + }, + { + 'x': 20401094600, + 'y': 3 + }, + { + 'x': 21474836400, + 'y': 7 + }, + { + 'x': 32212254700, + 'y': 4 + } + ] + } + ], + 'hits': 71, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/histogram/_slices.js b/bin/fixtures/vislib/mock_data/histogram/_slices.js new file mode 100644 index 00000000000000..0d280cad11bece --- /dev/null +++ b/bin/fixtures/vislib/mock_data/histogram/_slices.js @@ -0,0 +1,309 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'slices': { + 'children': [ + { + 'name': 0, + 'size': 378611, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 1000, + 'size': 205997, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 2000, + 'size': 397189, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 3000, + 'size': 397195, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 4000, + 'size': 398429, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 5000, + 'size': 397843, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 6000, + 'size': 398140, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 7000, + 'size': 398076, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 8000, + 'size': 396746, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 9000, + 'size': 397418, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 10000, + 'size': 20222, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 11000, + 'size': 20173, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 12000, + 'size': 20026, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 13000, + 'size': 19986, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 14000, + 'size': 20091, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 15000, + 'size': 20052, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 16000, + 'size': 20349, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 17000, + 'size': 20290, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 18000, + 'size': 20399, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 19000, + 'size': 20133, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + }, + { + 'name': 20000, + 'size': 9, + 'aggConfig': { + 'type': 'histogram', + 'schema': 'segment', + 'fieldFormatter': _.constant(String), + 'params': { + 'interval': 1000, + 'extended_bounds': {} + } + } + } + ] + }, + 'names': [ + 0, + 1000, + 2000, + 3000, + 4000, + 5000, + 6000, + 7000, + 8000, + 9000, + 10000, + 11000, + 12000, + 13000, + 14000, + 15000, + 16000, + 17000, + 18000, + 19000, + 20000 + ], + 'hits': 3967374, + 'tooltipFormatter': function (event) { + return event.point; + } +}; diff --git a/bin/fixtures/vislib/mock_data/not_enough_data/_one_point.js b/bin/fixtures/vislib/mock_data/not_enough_data/_one_point.js new file mode 100644 index 00000000000000..c08ba4444e37a3 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/not_enough_data/_one_point.js @@ -0,0 +1,32 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'xAxisLabel': '', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '_all', + 'y': 274 + } + ] + } + ], + 'hits': 274, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/range/_columns.js b/bin/fixtures/vislib/mock_data/range/_columns.js new file mode 100644 index 00000000000000..1ac57060f323d2 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/range/_columns.js @@ -0,0 +1,59 @@ +var _ = require('lodash'); + +module.exports = { + 'columns': [ + { + 'label': 'apache: _type', + 'xAxisLabel': 'bytes ranges', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '0.0-1000.0', + 'y': 13309 + }, + { + 'x': '1000.0-2000.0', + 'y': 7196 + } + ] + } + ] + }, + { + 'label': 'nginx: _type', + 'xAxisLabel': 'bytes ranges', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '0.0-1000.0', + 'y': 3278 + }, + { + 'x': '1000.0-2000.0', + 'y': 1804 + } + ] + } + ] + } + ], + 'hits': 171499, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/range/_rows.js b/bin/fixtures/vislib/mock_data/range/_rows.js new file mode 100644 index 00000000000000..3868b0ff9b27bb --- /dev/null +++ b/bin/fixtures/vislib/mock_data/range/_rows.js @@ -0,0 +1,84 @@ +var _ = require('lodash'); + +module.exports = { + 'rows': [ + { + 'label': 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw', + 'xAxisLabel': 'bytes ranges', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '0.0-1000.0', + 'y': 6422, + 'y0': 0 + }, + { + 'x': '1000.0-2000.0', + 'y': 3446, + 'y0': 0 + } + ] + } + ] + }, + { + 'label': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw', + 'xAxisLabel': 'bytes ranges', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '0.0-1000.0', + 'y': 5430, + 'y0': 0 + }, + { + 'x': '1000.0-2000.0', + 'y': 3010, + 'y0': 0 + } + ] + } + ] + }, + { + 'label': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw', + 'xAxisLabel': 'bytes ranges', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '0.0-1000.0', + 'y': 4735, + 'y0': 0 + }, + { + 'x': '1000.0-2000.0', + 'y': 2542, + 'y0': 0 + } + ] + } + ] + } + ], + 'hits': 171501, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/range/_series.js b/bin/fixtures/vislib/mock_data/range/_series.js new file mode 100644 index 00000000000000..4b5e8f61816958 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/range/_series.js @@ -0,0 +1,36 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'xAxisLabel': 'bytes ranges', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': '0.0-1000.0', + 'y': 16576 + }, + { + 'x': '1000.0-2000.0', + 'y': 9005 + } + ] + } + ], + 'hits': 171500, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/significant_terms/_columns.js b/bin/fixtures/vislib/mock_data/significant_terms/_columns.js new file mode 100644 index 00000000000000..3bdaa0dc3954a1 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/significant_terms/_columns.js @@ -0,0 +1,232 @@ +var _ = require('lodash'); + +module.exports = { + 'columns': [ + { + 'label': 'http: links', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 144000 + }, + { + 'x': 'info', + 'y': 128237 + }, + { + 'x': 'security', + 'y': 34518 + }, + { + 'x': 'error', + 'y': 10258 + }, + { + 'x': 'warning', + 'y': 17188 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'info: links', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 108148 + }, + { + 'x': 'info', + 'y': 96242 + }, + { + 'x': 'security', + 'y': 25889 + }, + { + 'x': 'error', + 'y': 7673 + }, + { + 'x': 'warning', + 'y': 12842 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'www.slate.com: links', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 98056 + }, + { + 'x': 'info', + 'y': 87344 + }, + { + 'x': 'security', + 'y': 23577 + }, + { + 'x': 'error', + 'y': 7004 + }, + { + 'x': 'warning', + 'y': 11759 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'twitter.com: links', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 74154 + }, + { + 'x': 'info', + 'y': 65963 + }, + { + 'x': 'security', + 'y': 17832 + }, + { + 'x': 'error', + 'y': 5258 + }, + { + 'x': 'warning', + 'y': 8906 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'www.www.slate.com: links', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 62591 + }, + { + 'x': 'info', + 'y': 55822 + }, + { + 'x': 'security', + 'y': 15100 + }, + { + 'x': 'error', + 'y': 4564 + }, + { + 'x': 'warning', + 'y': 7498 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 171446 +}; diff --git a/bin/fixtures/vislib/mock_data/significant_terms/_rows.js b/bin/fixtures/vislib/mock_data/significant_terms/_rows.js new file mode 100644 index 00000000000000..b7d07251b5ca8f --- /dev/null +++ b/bin/fixtures/vislib/mock_data/significant_terms/_rows.js @@ -0,0 +1,232 @@ +var _ = require('lodash'); + +module.exports = { + 'rows': [ + { + 'label': 'h3: headings', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 144000 + }, + { + 'x': 'info', + 'y': 128235 + }, + { + 'x': 'security', + 'y': 34518 + }, + { + 'x': 'error', + 'y': 10257 + }, + { + 'x': 'warning', + 'y': 17188 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'h5: headings', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 144000 + }, + { + 'x': 'info', + 'y': 128235 + }, + { + 'x': 'security', + 'y': 34518 + }, + { + 'x': 'error', + 'y': 10257 + }, + { + 'x': 'warning', + 'y': 17188 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'http: headings', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 144000 + }, + { + 'x': 'info', + 'y': 128235 + }, + { + 'x': 'security', + 'y': 34518 + }, + { + 'x': 'error', + 'y': 10257 + }, + { + 'x': 'warning', + 'y': 17188 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'success: headings', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 120689 + }, + { + 'x': 'info', + 'y': 107621 + }, + { + 'x': 'security', + 'y': 28916 + }, + { + 'x': 'error', + 'y': 8590 + }, + { + 'x': 'warning', + 'y': 14548 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': 'www.slate.com: headings', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 62292 + }, + { + 'x': 'info', + 'y': 55646 + }, + { + 'x': 'security', + 'y': 14823 + }, + { + 'x': 'error', + 'y': 4441 + }, + { + 'x': 'warning', + 'y': 7539 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 171445 +}; diff --git a/bin/fixtures/vislib/mock_data/significant_terms/_series.js b/bin/fixtures/vislib/mock_data/significant_terms/_series.js new file mode 100644 index 00000000000000..c4feebaef9d4d4 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/significant_terms/_series.js @@ -0,0 +1,48 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'xAxisLabel': 'Top 5 unusual terms in @tags', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'success', + 'y': 143995 + }, + { + 'x': 'info', + 'y': 128233 + }, + { + 'x': 'security', + 'y': 34515 + }, + { + 'x': 'error', + 'y': 10256 + }, + { + 'x': 'warning', + 'y': 17188 + } + ] + } + ], + 'hits': 171439, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/stacked/_stacked.js b/bin/fixtures/vislib/mock_data/stacked/_stacked.js new file mode 100644 index 00000000000000..2df6f83a683075 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/stacked/_stacked.js @@ -0,0 +1,1572 @@ +var moment = require('moment'); + +module.exports = { + 'label': '', + 'xAxisLabel': '@timestamp per 30 sec', + 'ordered': { + 'date': true, + 'interval': 30000, + 'min': 1416850340336, + 'max': 1416852140336 + }, + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'label': 'jpg', + 'values': [ + { + 'x': 1416850320000, + 'y': 110, + 'y0': 0 + }, + { + 'x': 1416850350000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416850380000, + 'y': 34, + 'y0': 0 + }, + { + 'x': 1416850410000, + 'y': 21, + 'y0': 0 + }, + { + 'x': 1416850440000, + 'y': 32, + 'y0': 0 + }, + { + 'x': 1416850470000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416850500000, + 'y': 16, + 'y0': 0 + }, + { + 'x': 1416850530000, + 'y': 27, + 'y0': 0 + }, + { + 'x': 1416850560000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416850590000, + 'y': 38, + 'y0': 0 + }, + { + 'x': 1416850620000, + 'y': 33, + 'y0': 0 + }, + { + 'x': 1416850650000, + 'y': 33, + 'y0': 0 + }, + { + 'x': 1416850680000, + 'y': 31, + 'y0': 0 + }, + { + 'x': 1416850710000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416850740000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416850770000, + 'y': 38, + 'y0': 0 + }, + { + 'x': 1416850800000, + 'y': 34, + 'y0': 0 + }, + { + 'x': 1416850830000, + 'y': 30, + 'y0': 0 + }, + { + 'x': 1416850860000, + 'y': 38, + 'y0': 0 + }, + { + 'x': 1416850890000, + 'y': 19, + 'y0': 0 + }, + { + 'x': 1416850920000, + 'y': 23, + 'y0': 0 + }, + { + 'x': 1416850950000, + 'y': 33, + 'y0': 0 + }, + { + 'x': 1416850980000, + 'y': 28, + 'y0': 0 + }, + { + 'x': 1416851010000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416851040000, + 'y': 22, + 'y0': 0 + }, + { + 'x': 1416851070000, + 'y': 28, + 'y0': 0 + }, + { + 'x': 1416851100000, + 'y': 27, + 'y0': 0 + }, + { + 'x': 1416851130000, + 'y': 32, + 'y0': 0 + }, + { + 'x': 1416851160000, + 'y': 32, + 'y0': 0 + }, + { + 'x': 1416851190000, + 'y': 30, + 'y0': 0 + }, + { + 'x': 1416851220000, + 'y': 32, + 'y0': 0 + }, + { + 'x': 1416851250000, + 'y': 36, + 'y0': 0 + }, + { + 'x': 1416851280000, + 'y': 32, + 'y0': 0 + }, + { + 'x': 1416851310000, + 'y': 29, + 'y0': 0 + }, + { + 'x': 1416851340000, + 'y': 22, + 'y0': 0 + }, + { + 'x': 1416851370000, + 'y': 29, + 'y0': 0 + }, + { + 'x': 1416851400000, + 'y': 33, + 'y0': 0 + }, + { + 'x': 1416851430000, + 'y': 28, + 'y0': 0 + }, + { + 'x': 1416851460000, + 'y': 39, + 'y0': 0 + }, + { + 'x': 1416851490000, + 'y': 28, + 'y0': 0 + }, + { + 'x': 1416851520000, + 'y': 28, + 'y0': 0 + }, + { + 'x': 1416851550000, + 'y': 28, + 'y0': 0 + }, + { + 'x': 1416851580000, + 'y': 30, + 'y0': 0 + }, + { + 'x': 1416851610000, + 'y': 29, + 'y0': 0 + }, + { + 'x': 1416851640000, + 'y': 30, + 'y0': 0 + }, + { + 'x': 1416851670000, + 'y': 23, + 'y0': 0 + }, + { + 'x': 1416851700000, + 'y': 23, + 'y0': 0 + }, + { + 'x': 1416851730000, + 'y': 27, + 'y0': 0 + }, + { + 'x': 1416851760000, + 'y': 21, + 'y0': 0 + }, + { + 'x': 1416851790000, + 'y': 24, + 'y0': 0 + }, + { + 'x': 1416851820000, + 'y': 26, + 'y0': 0 + }, + { + 'x': 1416851850000, + 'y': 26, + 'y0': 0 + }, + { + 'x': 1416851880000, + 'y': 21, + 'y0': 0 + }, + { + 'x': 1416851910000, + 'y': 33, + 'y0': 0 + }, + { + 'x': 1416851940000, + 'y': 23, + 'y0': 0 + }, + { + 'x': 1416851970000, + 'y': 46, + 'y0': 0 + }, + { + 'x': 1416852000000, + 'y': 27, + 'y0': 0 + }, + { + 'x': 1416852030000, + 'y': 20, + 'y0': 0 + }, + { + 'x': 1416852060000, + 'y': 34, + 'y0': 0 + }, + { + 'x': 1416852090000, + 'y': 15, + 'y0': 0 + }, + { + 'x': 1416852120000, + 'y': 18, + 'y0': 0 + } + ] + }, + { + 'label': 'css', + 'values': [ + { + 'x': 1416850320000, + 'y': 3, + 'y0': 11 + }, + { + 'x': 1416850350000, + 'y': 13, + 'y0': 24 + }, + { + 'x': 1416850380000, + 'y': 5, + 'y0': 34 + }, + { + 'x': 1416850410000, + 'y': 12, + 'y0': 21 + }, + { + 'x': 1416850440000, + 'y': 9, + 'y0': 32 + }, + { + 'x': 1416850470000, + 'y': 12, + 'y0': 24 + }, + { + 'x': 1416850500000, + 'y': 6, + 'y0': 16 + }, + { + 'x': 1416850530000, + 'y': 6, + 'y0': 27 + }, + { + 'x': 1416850560000, + 'y': 11, + 'y0': 24 + }, + { + 'x': 1416850590000, + 'y': 11, + 'y0': 38 + }, + { + 'x': 1416850620000, + 'y': 6, + 'y0': 33 + }, + { + 'x': 1416850650000, + 'y': 8, + 'y0': 33 + }, + { + 'x': 1416850680000, + 'y': 6, + 'y0': 31 + }, + { + 'x': 1416850710000, + 'y': 4, + 'y0': 24 + }, + { + 'x': 1416850740000, + 'y': 9, + 'y0': 24 + }, + { + 'x': 1416850770000, + 'y': 3, + 'y0': 38 + }, + { + 'x': 1416850800000, + 'y': 5, + 'y0': 34 + }, + { + 'x': 1416850830000, + 'y': 6, + 'y0': 30 + }, + { + 'x': 1416850860000, + 'y': 9, + 'y0': 38 + }, + { + 'x': 1416850890000, + 'y': 5, + 'y0': 19 + }, + { + 'x': 1416850920000, + 'y': 8, + 'y0': 23 + }, + { + 'x': 1416850950000, + 'y': 9, + 'y0': 33 + }, + { + 'x': 1416850980000, + 'y': 5, + 'y0': 28 + }, + { + 'x': 1416851010000, + 'y': 6, + 'y0': 24 + }, + { + 'x': 1416851040000, + 'y': 9, + 'y0': 22 + }, + { + 'x': 1416851070000, + 'y': 9, + 'y0': 28 + }, + { + 'x': 1416851100000, + 'y': 11, + 'y0': 27 + }, + { + 'x': 1416851130000, + 'y': 5, + 'y0': 32 + }, + { + 'x': 1416851160000, + 'y': 8, + 'y0': 32 + }, + { + 'x': 1416851190000, + 'y': 6, + 'y0': 30 + }, + { + 'x': 1416851220000, + 'y': 10, + 'y0': 32 + }, + { + 'x': 1416851250000, + 'y': 5, + 'y0': 36 + }, + { + 'x': 1416851280000, + 'y': 6, + 'y0': 32 + }, + { + 'x': 1416851310000, + 'y': 4, + 'y0': 29 + }, + { + 'x': 1416851340000, + 'y': 8, + 'y0': 22 + }, + { + 'x': 1416851370000, + 'y': 3, + 'y0': 29 + }, + { + 'x': 1416851400000, + 'y': 8, + 'y0': 33 + }, + { + 'x': 1416851430000, + 'y': 10, + 'y0': 28 + }, + { + 'x': 1416851460000, + 'y': 5, + 'y0': 39 + }, + { + 'x': 1416851490000, + 'y': 7, + 'y0': 28 + }, + { + 'x': 1416851520000, + 'y': 6, + 'y0': 28 + }, + { + 'x': 1416851550000, + 'y': 4, + 'y0': 28 + }, + { + 'x': 1416851580000, + 'y': 9, + 'y0': 30 + }, + { + 'x': 1416851610000, + 'y': 3, + 'y0': 29 + }, + { + 'x': 1416851640000, + 'y': 9, + 'y0': 30 + }, + { + 'x': 1416851670000, + 'y': 6, + 'y0': 23 + }, + { + 'x': 1416851700000, + 'y': 11, + 'y0': 23 + }, + { + 'x': 1416851730000, + 'y': 4, + 'y0': 27 + }, + { + 'x': 1416851760000, + 'y': 8, + 'y0': 21 + }, + { + 'x': 1416851790000, + 'y': 5, + 'y0': 24 + }, + { + 'x': 1416851820000, + 'y': 7, + 'y0': 26 + }, + { + 'x': 1416851850000, + 'y': 7, + 'y0': 26 + }, + { + 'x': 1416851880000, + 'y': 4, + 'y0': 21 + }, + { + 'x': 1416851910000, + 'y': 8, + 'y0': 33 + }, + { + 'x': 1416851940000, + 'y': 6, + 'y0': 23 + }, + { + 'x': 1416851970000, + 'y': 6, + 'y0': 46 + }, + { + 'x': 1416852000000, + 'y': 3, + 'y0': 27 + }, + { + 'x': 1416852030000, + 'y': 6, + 'y0': 20 + }, + { + 'x': 1416852060000, + 'y': 5, + 'y0': 34 + }, + { + 'x': 1416852090000, + 'y': 5, + 'y0': 15 + }, + { + 'x': 1416852120000, + 'y': 1, + 'y0': 18 + } + ] + }, + { + 'label': 'gif', + 'values': [ + { + 'x': 1416850320000, + 'y': 1, + 'y0': 14 + }, + { + 'x': 1416850350000, + 'y': 2, + 'y0': 37 + }, + { + 'x': 1416850380000, + 'y': 4, + 'y0': 39 + }, + { + 'x': 1416850410000, + 'y': 2, + 'y0': 33 + }, + { + 'x': 1416850440000, + 'y': 3, + 'y0': 41 + }, + { + 'x': 1416850470000, + 'y': 1, + 'y0': 36 + }, + { + 'x': 1416850500000, + 'y': 1, + 'y0': 22 + }, + { + 'x': 1416850530000, + 'y': 1, + 'y0': 33 + }, + { + 'x': 1416850560000, + 'y': 2, + 'y0': 35 + }, + { + 'x': 1416850590000, + 'y': 5, + 'y0': 49 + }, + { + 'x': 1416850620000, + 'y': 1, + 'y0': 39 + }, + { + 'x': 1416850650000, + 'y': 1, + 'y0': 41 + }, + { + 'x': 1416850680000, + 'y': 4, + 'y0': 37 + }, + { + 'x': 1416850710000, + 'y': 1, + 'y0': 28 + }, + { + 'x': 1416850740000, + 'y': 3, + 'y0': 33 + }, + { + 'x': 1416850770000, + 'y': 2, + 'y0': 41 + }, + { + 'x': 1416850800000, + 'y': 2, + 'y0': 39 + }, + { + 'x': 1416850830000, + 'y': 5, + 'y0': 36 + }, + { + 'x': 1416850860000, + 'y': 3, + 'y0': 47 + }, + { + 'x': 1416850890000, + 'y': 1, + 'y0': 24 + }, + { + 'x': 1416850920000, + 'y': 3, + 'y0': 31 + }, + { + 'x': 1416850950000, + 'y': 4, + 'y0': 42 + }, + { + 'x': 1416850980000, + 'y': 3, + 'y0': 33 + }, + { + 'x': 1416851010000, + 'y': 5, + 'y0': 30 + }, + { + 'x': 1416851040000, + 'y': 2, + 'y0': 31 + }, + { + 'x': 1416851070000, + 'y': 3, + 'y0': 37 + }, + { + 'x': 1416851100000, + 'y': 5, + 'y0': 38 + }, + { + 'x': 1416851130000, + 'y': 3, + 'y0': 37 + }, + { + 'x': 1416851160000, + 'y': 4, + 'y0': 40 + }, + { + 'x': 1416851190000, + 'y': 9, + 'y0': 36 + }, + { + 'x': 1416851220000, + 'y': 7, + 'y0': 42 + }, + { + 'x': 1416851250000, + 'y': 2, + 'y0': 41 + }, + { + 'x': 1416851280000, + 'y': 1, + 'y0': 38 + }, + { + 'x': 1416851310000, + 'y': 2, + 'y0': 33 + }, + { + 'x': 1416851340000, + 'y': 5, + 'y0': 30 + }, + { + 'x': 1416851370000, + 'y': 3, + 'y0': 32 + }, + { + 'x': 1416851400000, + 'y': 5, + 'y0': 41 + }, + { + 'x': 1416851430000, + 'y': 4, + 'y0': 38 + }, + { + 'x': 1416851460000, + 'y': 5, + 'y0': 44 + }, + { + 'x': 1416851490000, + 'y': 2, + 'y0': 35 + }, + { + 'x': 1416851520000, + 'y': 2, + 'y0': 34 + }, + { + 'x': 1416851550000, + 'y': 4, + 'y0': 32 + }, + { + 'x': 1416851580000, + 'y': 3, + 'y0': 39 + }, + { + 'x': 1416851610000, + 'y': 4, + 'y0': 32 + }, + { + 'x': 1416851640000, + 'y': 0, + 'y0': 39 + }, + { + 'x': 1416851670000, + 'y': 2, + 'y0': 29 + }, + { + 'x': 1416851700000, + 'y': 1, + 'y0': 34 + }, + { + 'x': 1416851730000, + 'y': 3, + 'y0': 31 + }, + { + 'x': 1416851760000, + 'y': 0, + 'y0': 29 + }, + { + 'x': 1416851790000, + 'y': 4, + 'y0': 29 + }, + { + 'x': 1416851820000, + 'y': 3, + 'y0': 33 + }, + { + 'x': 1416851850000, + 'y': 3, + 'y0': 33 + }, + { + 'x': 1416851880000, + 'y': 0, + 'y0': 25 + }, + { + 'x': 1416851910000, + 'y': 0, + 'y0': 41 + }, + { + 'x': 1416851940000, + 'y': 3, + 'y0': 29 + }, + { + 'x': 1416851970000, + 'y': 3, + 'y0': 52 + }, + { + 'x': 1416852000000, + 'y': 1, + 'y0': 30 + }, + { + 'x': 1416852030000, + 'y': 5, + 'y0': 26 + }, + { + 'x': 1416852060000, + 'y': 3, + 'y0': 39 + }, + { + 'x': 1416852090000, + 'y': 1, + 'y0': 20 + }, + { + 'x': 1416852120000, + 'y': 2, + 'y0': 19 + } + ] + }, + { + 'label': 'png', + 'values': [ + { + 'x': 1416850320000, + 'y': 1, + 'y0': 15 + }, + { + 'x': 1416850350000, + 'y': 6, + 'y0': 39 + }, + { + 'x': 1416850380000, + 'y': 6, + 'y0': 43 + }, + { + 'x': 1416850410000, + 'y': 5, + 'y0': 35 + }, + { + 'x': 1416850440000, + 'y': 3, + 'y0': 44 + }, + { + 'x': 1416850470000, + 'y': 5, + 'y0': 37 + }, + { + 'x': 1416850500000, + 'y': 6, + 'y0': 23 + }, + { + 'x': 1416850530000, + 'y': 1, + 'y0': 34 + }, + { + 'x': 1416850560000, + 'y': 3, + 'y0': 37 + }, + { + 'x': 1416850590000, + 'y': 2, + 'y0': 54 + }, + { + 'x': 1416850620000, + 'y': 1, + 'y0': 40 + }, + { + 'x': 1416850650000, + 'y': 1, + 'y0': 42 + }, + { + 'x': 1416850680000, + 'y': 2, + 'y0': 41 + }, + { + 'x': 1416850710000, + 'y': 5, + 'y0': 29 + }, + { + 'x': 1416850740000, + 'y': 7, + 'y0': 36 + }, + { + 'x': 1416850770000, + 'y': 2, + 'y0': 43 + }, + { + 'x': 1416850800000, + 'y': 3, + 'y0': 41 + }, + { + 'x': 1416850830000, + 'y': 6, + 'y0': 41 + }, + { + 'x': 1416850860000, + 'y': 2, + 'y0': 50 + }, + { + 'x': 1416850890000, + 'y': 4, + 'y0': 25 + }, + { + 'x': 1416850920000, + 'y': 2, + 'y0': 34 + }, + { + 'x': 1416850950000, + 'y': 3, + 'y0': 46 + }, + { + 'x': 1416850980000, + 'y': 8, + 'y0': 36 + }, + { + 'x': 1416851010000, + 'y': 4, + 'y0': 35 + }, + { + 'x': 1416851040000, + 'y': 4, + 'y0': 33 + }, + { + 'x': 1416851070000, + 'y': 1, + 'y0': 40 + }, + { + 'x': 1416851100000, + 'y': 2, + 'y0': 43 + }, + { + 'x': 1416851130000, + 'y': 4, + 'y0': 40 + }, + { + 'x': 1416851160000, + 'y': 3, + 'y0': 44 + }, + { + 'x': 1416851190000, + 'y': 4, + 'y0': 45 + }, + { + 'x': 1416851220000, + 'y': 2, + 'y0': 49 + }, + { + 'x': 1416851250000, + 'y': 4, + 'y0': 43 + }, + { + 'x': 1416851280000, + 'y': 8, + 'y0': 39 + }, + { + 'x': 1416851310000, + 'y': 4, + 'y0': 35 + }, + { + 'x': 1416851340000, + 'y': 4, + 'y0': 35 + }, + { + 'x': 1416851370000, + 'y': 7, + 'y0': 35 + }, + { + 'x': 1416851400000, + 'y': 2, + 'y0': 46 + }, + { + 'x': 1416851430000, + 'y': 3, + 'y0': 42 + }, + { + 'x': 1416851460000, + 'y': 3, + 'y0': 49 + }, + { + 'x': 1416851490000, + 'y': 3, + 'y0': 37 + }, + { + 'x': 1416851520000, + 'y': 4, + 'y0': 36 + }, + { + 'x': 1416851550000, + 'y': 3, + 'y0': 36 + }, + { + 'x': 1416851580000, + 'y': 4, + 'y0': 42 + }, + { + 'x': 1416851610000, + 'y': 5, + 'y0': 36 + }, + { + 'x': 1416851640000, + 'y': 3, + 'y0': 39 + }, + { + 'x': 1416851670000, + 'y': 3, + 'y0': 31 + }, + { + 'x': 1416851700000, + 'y': 2, + 'y0': 35 + }, + { + 'x': 1416851730000, + 'y': 5, + 'y0': 34 + }, + { + 'x': 1416851760000, + 'y': 4, + 'y0': 29 + }, + { + 'x': 1416851790000, + 'y': 5, + 'y0': 33 + }, + { + 'x': 1416851820000, + 'y': 1, + 'y0': 36 + }, + { + 'x': 1416851850000, + 'y': 3, + 'y0': 36 + }, + { + 'x': 1416851880000, + 'y': 6, + 'y0': 25 + }, + { + 'x': 1416851910000, + 'y': 4, + 'y0': 41 + }, + { + 'x': 1416851940000, + 'y': 7, + 'y0': 32 + }, + { + 'x': 1416851970000, + 'y': 5, + 'y0': 55 + }, + { + 'x': 1416852000000, + 'y': 2, + 'y0': 31 + }, + { + 'x': 1416852030000, + 'y': 2, + 'y0': 31 + }, + { + 'x': 1416852060000, + 'y': 4, + 'y0': 42 + }, + { + 'x': 1416852090000, + 'y': 6, + 'y0': 21 + }, + { + 'x': 1416852120000, + 'y': 2, + 'y0': 21 + } + ] + }, + { + 'label': 'php', + 'values': [ + { + 'x': 1416850320000, + 'y': 0, + 'y0': 16 + }, + { + 'x': 1416850350000, + 'y': 1, + 'y0': 45 + }, + { + 'x': 1416850380000, + 'y': 0, + 'y0': 49 + }, + { + 'x': 1416850410000, + 'y': 2, + 'y0': 40 + }, + { + 'x': 1416850440000, + 'y': 0, + 'y0': 47 + }, + { + 'x': 1416850470000, + 'y': 0, + 'y0': 42 + }, + { + 'x': 1416850500000, + 'y': 3, + 'y0': 29 + }, + { + 'x': 1416850530000, + 'y': 1, + 'y0': 35 + }, + { + 'x': 1416850560000, + 'y': 3, + 'y0': 40 + }, + { + 'x': 1416850590000, + 'y': 2, + 'y0': 56 + }, + { + 'x': 1416850620000, + 'y': 2, + 'y0': 41 + }, + { + 'x': 1416850650000, + 'y': 5, + 'y0': 43 + }, + { + 'x': 1416850680000, + 'y': 2, + 'y0': 43 + }, + { + 'x': 1416850710000, + 'y': 1, + 'y0': 34 + }, + { + 'x': 1416850740000, + 'y': 2, + 'y0': 43 + }, + { + 'x': 1416850770000, + 'y': 2, + 'y0': 45 + }, + { + 'x': 1416850800000, + 'y': 1, + 'y0': 44 + }, + { + 'x': 1416850830000, + 'y': 1, + 'y0': 47 + }, + { + 'x': 1416850860000, + 'y': 1, + 'y0': 52 + }, + { + 'x': 1416850890000, + 'y': 1, + 'y0': 29 + }, + { + 'x': 1416850920000, + 'y': 2, + 'y0': 36 + }, + { + 'x': 1416850950000, + 'y': 2, + 'y0': 49 + }, + { + 'x': 1416850980000, + 'y': 0, + 'y0': 44 + }, + { + 'x': 1416851010000, + 'y': 3, + 'y0': 39 + }, + { + 'x': 1416851040000, + 'y': 2, + 'y0': 37 + }, + { + 'x': 1416851070000, + 'y': 2, + 'y0': 41 + }, + { + 'x': 1416851100000, + 'y': 2, + 'y0': 45 + }, + { + 'x': 1416851130000, + 'y': 0, + 'y0': 44 + }, + { + 'x': 1416851160000, + 'y': 1, + 'y0': 47 + }, + { + 'x': 1416851190000, + 'y': 2, + 'y0': 49 + }, + { + 'x': 1416851220000, + 'y': 4, + 'y0': 51 + }, + { + 'x': 1416851250000, + 'y': 0, + 'y0': 47 + }, + { + 'x': 1416851280000, + 'y': 3, + 'y0': 47 + }, + { + 'x': 1416851310000, + 'y': 3, + 'y0': 39 + }, + { + 'x': 1416851340000, + 'y': 2, + 'y0': 39 + }, + { + 'x': 1416851370000, + 'y': 2, + 'y0': 42 + }, + { + 'x': 1416851400000, + 'y': 3, + 'y0': 48 + }, + { + 'x': 1416851430000, + 'y': 1, + 'y0': 45 + }, + { + 'x': 1416851460000, + 'y': 0, + 'y0': 52 + }, + { + 'x': 1416851490000, + 'y': 2, + 'y0': 40 + }, + { + 'x': 1416851520000, + 'y': 1, + 'y0': 40 + }, + { + 'x': 1416851550000, + 'y': 3, + 'y0': 39 + }, + { + 'x': 1416851580000, + 'y': 1, + 'y0': 46 + }, + { + 'x': 1416851610000, + 'y': 2, + 'y0': 41 + }, + { + 'x': 1416851640000, + 'y': 1, + 'y0': 42 + }, + { + 'x': 1416851670000, + 'y': 2, + 'y0': 34 + }, + { + 'x': 1416851700000, + 'y': 3, + 'y0': 37 + }, + { + 'x': 1416851730000, + 'y': 1, + 'y0': 39 + }, + { + 'x': 1416851760000, + 'y': 1, + 'y0': 33 + }, + { + 'x': 1416851790000, + 'y': 1, + 'y0': 38 + }, + { + 'x': 1416851820000, + 'y': 1, + 'y0': 37 + }, + { + 'x': 1416851850000, + 'y': 1, + 'y0': 39 + }, + { + 'x': 1416851880000, + 'y': 1, + 'y0': 31 + }, + { + 'x': 1416851910000, + 'y': 2, + 'y0': 45 + }, + { + 'x': 1416851940000, + 'y': 0, + 'y0': 39 + }, + { + 'x': 1416851970000, + 'y': 0, + 'y0': 60 + }, + { + 'x': 1416852000000, + 'y': 1, + 'y0': 33 + }, + { + 'x': 1416852030000, + 'y': 2, + 'y0': 33 + }, + { + 'x': 1416852060000, + 'y': 1, + 'y0': 46 + }, + { + 'x': 1416852090000, + 'y': 1, + 'y0': 27 + }, + { + 'x': 1416852120000, + 'y': 0, + 'y0': 23 + } + ] + } + ], + 'hits': 2595, + 'xAxisFormatter': function (thing) { + return moment(thing); + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/fixtures/vislib/mock_data/terms/_columns.js b/bin/fixtures/vislib/mock_data/terms/_columns.js new file mode 100644 index 00000000000000..5ddb10819f5dd7 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/terms/_columns.js @@ -0,0 +1,142 @@ +var _ = require('lodash'); + +module.exports = { + 'columns': [ + { + 'label': 'logstash: index', + 'xAxisLabel': 'Top 5 extension', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'jpg', + 'y': 110710 + }, + { + 'x': 'css', + 'y': 27376 + }, + { + 'x': 'png', + 'y': 16664 + }, + { + 'x': 'gif', + 'y': 11264 + }, + { + 'x': 'php', + 'y': 5448 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '2014.11.12: index', + 'xAxisLabel': 'Top 5 extension', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'jpg', + 'y': 110643 + }, + { + 'x': 'css', + 'y': 27350 + }, + { + 'x': 'png', + 'y': 16648 + }, + { + 'x': 'gif', + 'y': 11257 + }, + { + 'x': 'php', + 'y': 5440 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '2014.11.11: index', + 'xAxisLabel': 'Top 5 extension', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'jpg', + 'y': 67 + }, + { + 'x': 'css', + 'y': 26 + }, + { + 'x': 'png', + 'y': 16 + }, + { + 'x': 'gif', + 'y': 7 + }, + { + 'x': 'php', + 'y': 8 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 171462 +}; diff --git a/bin/fixtures/vislib/mock_data/terms/_rows.js b/bin/fixtures/vislib/mock_data/terms/_rows.js new file mode 100644 index 00000000000000..46e06d57f2e4c3 --- /dev/null +++ b/bin/fixtures/vislib/mock_data/terms/_rows.js @@ -0,0 +1,97 @@ +var _ = require('lodash'); + +module.exports = { + 'rows': [ + { + 'label': '0.0-1000.0: bytes', + 'xAxisLabel': 'Top 5 extension', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'jpg', + 'y': 3378 + }, + { + 'x': 'css', + 'y': 762 + }, + { + 'x': 'png', + 'y': 527 + }, + { + 'x': 'gif', + 'y': 11258 + }, + { + 'x': 'php', + 'y': 653 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + }, + { + 'label': '1000.0-2000.0: bytes', + 'xAxisLabel': 'Top 5 extension', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'jpg', + 'y': 6422 + }, + { + 'x': 'css', + 'y': 1591 + }, + { + 'x': 'png', + 'y': 430 + }, + { + 'x': 'gif', + 'y': 8 + }, + { + 'x': 'php', + 'y': 561 + } + ] + } + ], + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } + } + ], + 'hits': 171458 +}; diff --git a/bin/fixtures/vislib/mock_data/terms/_series.js b/bin/fixtures/vislib/mock_data/terms/_series.js new file mode 100644 index 00000000000000..f3732f6061764e --- /dev/null +++ b/bin/fixtures/vislib/mock_data/terms/_series.js @@ -0,0 +1,48 @@ +var _ = require('lodash'); + +module.exports = { + 'label': '', + 'xAxisLabel': 'Top 5 extension', + 'yAxisLabel': 'Count of documents', + 'series': [ + { + 'values': [ + { + 'x': 'jpg', + 'y': 110710 + }, + { + 'x': 'css', + 'y': 27389 + }, + { + 'x': 'png', + 'y': 16661 + }, + { + 'x': 'gif', + 'y': 11269 + }, + { + 'x': 'php', + 'y': 5447 + } + ] + } + ], + 'hits': 171476, + 'xAxisFormatter': function (val) { + if (_.isObject(val)) { + return JSON.stringify(val); + } + else if (val == null) { + return ''; + } + else { + return '' + val; + } + }, + 'tooltipFormatter': function (d) { + return d; + } +}; diff --git a/bin/optimize/BaseOptimizer.js b/bin/optimize/BaseOptimizer.js new file mode 100644 index 00000000000000..0bf12fbde42df4 --- /dev/null +++ b/bin/optimize/BaseOptimizer.js @@ -0,0 +1,174 @@ +let { inherits } = require('util'); +let { defaults } = require('lodash'); +let { resolve } = require('path'); +let { writeFile } = require('fs'); +let webpack = require('webpack'); +var Boom = require('boom'); +let DirectoryNameAsMain = require('webpack-directory-name-as-main'); +let ExtractTextPlugin = require('extract-text-webpack-plugin'); +var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); + +let utils = require('requirefrom')('src/utils'); +let fromRoot = utils('fromRoot'); +let babelOptions = require('./babelOptions'); +let babelExclude = [/[\/\\](webpackShims|node_modules|bower_components)[\/\\]/]; + +class BaseOptimizer { + constructor(opts) { + this.env = opts.env; + this.bundles = opts.bundles; + this.profile = opts.profile || false; + + switch (opts.sourceMaps) { + case true: + this.sourceMaps = 'source-map'; + break; + + case 'fast': + this.sourceMaps = 'cheap-module-eval-source-map'; + break; + + default: + this.sourceMaps = opts.sourceMaps || false; + break; + } + + this.unsafeCache = opts.unsafeCache || false; + if (typeof this.unsafeCache === 'string') { + this.unsafeCache = [ + new RegExp(this.unsafeCache.slice(1, -1)) + ]; + } + } + + async initCompiler() { + if (this.compiler) return this.compiler; + + let compilerConfig = this.getConfig(); + this.compiler = webpack(compilerConfig); + + this.compiler.plugin('done', stats => { + if (!this.profile) return; + + let path = resolve(this.env.workingDir, 'stats.json'); + let content = JSON.stringify(stats.toJson()); + writeFile(path, content, function (err) { + if (err) throw err; + }); + }); + + return this.compiler; + } + + getConfig() { + let mapQ = this.sourceMaps ? '?sourceMap' : ''; + + return { + context: fromRoot('.'), + entry: this.bundles.toWebpackEntries(), + + devtool: this.sourceMaps, + profile: this.profile || false, + + output: { + path: this.env.workingDir, + filename: '[name].bundle.js', + sourceMapFilename: '[file].map', + publicPath: '/bundles/', + devtoolModuleFilenameTemplate: '[absolute-resource-path]' + }, + + recordsPath: resolve(this.env.workingDir, 'webpack.records'), + + plugins: [ + new webpack.ResolverPlugin([ + new DirectoryNameAsMain() + ]), + new webpack.NoErrorsPlugin(), + new ExtractTextPlugin('[name].style.css', { + allChunks: true + }), + new CommonsChunkPlugin({ + name: 'commons', + filename: 'commons.bundle.js' + }), + ], + + module: { + loaders: [ + { + test: /\.less$/, + loader: ExtractTextPlugin.extract( + 'style', + `css${mapQ}!autoprefixer${mapQ ? mapQ + '&' : '?'}{ "browsers": ["last 2 versions","> 5%"] }!less${mapQ}` + ) + }, + { test: /\.css$/, loader: ExtractTextPlugin.extract('style', `css${mapQ}`) }, + { test: /\.jade$/, loader: 'jade' }, + { test: /\.json$/, loader: 'json' }, + { test: /\.(html|tmpl)$/, loader: 'raw' }, + { test: /\.png$/, loader: 'url?limit=10000&name=[path][name].[ext]' }, + { test: /\.(woff|woff2|ttf|eot|svg|ico)(\?|$)/, loader: 'file?name=[path][name].[ext]' }, + { test: /[\/\\]src[\/\\](plugins|ui)[\/\\].+\.js$/, loader: `rjs-repack${mapQ}` }, + { + test: /\.js$/, + exclude: babelExclude.concat(this.env.noParse), + loader: 'babel', + query: babelOptions.webpack + }, + { + test: /\.jsx$/, + exclude: babelExclude.concat(this.env.noParse), + loader: 'babel', + query: defaults({ + nonStandard: true, + }, babelOptions.webpack) + } + ].concat(this.env.loaders), + postLoaders: this.env.postLoaders || [], + noParse: this.env.noParse, + }, + + resolve: { + extensions: ['.js', '.json', '.jsx', '.less', ''], + postfixes: [''], + modulesDirectories: ['webpackShims', 'node_modules'], + loaderPostfixes: ['-loader', ''], + root: fromRoot('.'), + alias: this.env.aliases, + unsafeCache: this.unsafeCache, + }, + }; + } + + failedStatsToError(stats) { + let statFormatOpts = { + hash: false, // add the hash of the compilation + version: false, // add webpack version information + timings: false, // add timing information + assets: false, // add assets information + chunks: false, // add chunk information + chunkModules: false, // add built modules information to chunk information + modules: false, // add built modules information + cached: false, // add also information about cached (not built) modules + reasons: false, // add information about the reasons why modules are included + source: false, // add the source code of modules + errorDetails: false, // add details to errors (like resolving log) + chunkOrigins: false, // add the origins of chunks and chunk merging info + modulesSort: false, // (string) sort the modules by that field + chunksSort: false, // (string) sort the chunks by that field + assetsSort: false, // (string) sort the assets by that field + children: false, + }; + + let details = stats.toString(defaults({ colors: true }, statFormatOpts)); + + return Boom.create( + 500, + `Optimizations failure.\n${details.split('\n').join('\n ')}\n`, + stats.toJson(statFormatOpts) + ); + } +} + +module.exports = BaseOptimizer; diff --git a/bin/optimize/FsOptimizer.js b/bin/optimize/FsOptimizer.js new file mode 100644 index 00000000000000..0d35439a5a6444 --- /dev/null +++ b/bin/optimize/FsOptimizer.js @@ -0,0 +1,28 @@ +let { fromNode } = require('bluebird'); +let { writeFile } = require('fs'); + +let BaseOptimizer = require('./BaseOptimizer'); +let fromRoot = require('../utils/fromRoot'); + +module.exports = class FsOptimizer extends BaseOptimizer { + async init() { + await this.initCompiler(); + } + + async run() { + if (!this.compiler) await this.init(); + + let stats = await fromNode(cb => { + this.compiler.run((err, stats) => { + if (err || !stats) return cb(err); + + if (stats.hasErrors() || stats.hasWarnings()) { + return cb(this.failedStatsToError(stats)); + } + else { + cb(null, stats); + } + }); + }); + } +}; diff --git a/bin/optimize/babelOptions.build.js b/bin/optimize/babelOptions.build.js new file mode 100644 index 00000000000000..0a28899fac0561 --- /dev/null +++ b/bin/optimize/babelOptions.build.js @@ -0,0 +1,16 @@ +var cloneDeep = require('lodash').cloneDeep; +var fromRoot = require('path').resolve.bind(null, __dirname, '../../'); +process.env.BABEL_CACHE_PATH = fromRoot('optimize/.babelcache.json'); + +exports.webpack = { + stage: 1, + nonStandard: false, + optional: ['runtime'] +}; + +exports.node = cloneDeep({ + ignore: [ + fromRoot('src'), + /[\\\/](node_modules|bower_components)[\\\/]/ + ] +}, exports.webpack); diff --git a/bin/optimize/babelOptions.js b/bin/optimize/babelOptions.js new file mode 100644 index 00000000000000..e8fb666a14c7f3 --- /dev/null +++ b/bin/optimize/babelOptions.js @@ -0,0 +1,11 @@ +var cloneDeep = require('lodash').cloneDeep; +var fromRoot = require('path').resolve.bind(null, __dirname, '../../'); +process.env.BABEL_CACHE_PATH = fromRoot('optimize/.babelcache.json'); + +exports.webpack = { + stage: 1, + nonStandard: false, + optional: ['runtime'] +}; + +exports.node = cloneDeep(exports.webpack); diff --git a/bin/optimize/index.js b/bin/optimize/index.js new file mode 100644 index 00000000000000..1b2cf69e92e466 --- /dev/null +++ b/bin/optimize/index.js @@ -0,0 +1,55 @@ +module.exports = async (kbnServer, server, config) => { + if (!config.get('optimize.enabled')) return; + + // the lazy optimizer sets up two threads, one is the server listening + // on 5601 and the other is a server listening on 5602 that builds the + // bundles in a "middleware" style. + // + // the server listening on 5601 may be restarted a number of times, depending + // on the watch setup managed by the cli. It proxies all bundles/* requests to + // the other server. The server on 5602 is long running, in order to prevent + // complete rebuilds of the optimize content. + let lazy = config.get('optimize.lazy'); + if (lazy) { + return await kbnServer.mixin(require('./lazy/lazy')); + } + + let bundles = kbnServer.bundles; + server.exposeStaticDir('/bundles/{path*}', bundles.env.workingDir); + await bundles.writeEntryFiles(); + + // in prod, only bundle what looks invalid or missing + if (config.get('optimize.useBundleCache')) { + bundles = await bundles.getInvalidBundles(); + } + + // we might not have any work to do + if (!bundles.getIds().length) { + server.log( + ['debug', 'optimize'], + `All bundles are cached and ready to go!` + ); + return; + } + + // only require the FsOptimizer when we need to + let FsOptimizer = require('./FsOptimizer'); + let optimizer = new FsOptimizer({ + env: bundles.env, + bundles: bundles, + profile: config.get('optimize.profile'), + sourceMaps: config.get('optimize.sourceMaps'), + unsafeCache: config.get('optimize.unsafeCache'), + }); + + server.log( + ['info', 'optimize'], + `Optimizing and caching ${bundles.desc()}. This may take a few minutes` + ); + + let start = Date.now(); + await optimizer.run(); + let seconds = ((Date.now() - start) / 1000).toFixed(2); + + server.log(['info', 'optimize'], `Optimization of ${bundles.desc()} complete in ${seconds} seconds`); +}; diff --git a/bin/optimize/lazy/LazyOptimizer.js b/bin/optimize/lazy/LazyOptimizer.js new file mode 100644 index 00000000000000..a221e2d1ecce74 --- /dev/null +++ b/bin/optimize/lazy/LazyOptimizer.js @@ -0,0 +1,117 @@ +let { once, pick, size } = require('lodash'); +let { join } = require('path'); +let Boom = require('boom'); + +let BaseOptimizer = require('../BaseOptimizer'); +let WeirdControlFlow = require('./WeirdControlFlow'); + +module.exports = class LazyOptimizer extends BaseOptimizer { + constructor(opts) { + super(opts); + this.log = opts.log || (() => null); + this.prebuild = opts.prebuild || false; + + this.timer = { + ms: null, + start: () => this.timer.ms = Date.now(), + end: () => this.timer.ms = ((Date.now() - this.timer.ms) / 1000).toFixed(2) + }; + + this.build = new WeirdControlFlow(); + } + + async init() { + this.initializing = true; + + await this.bundles.writeEntryFiles(); + await this.initCompiler(); + + this.compiler.plugin('watch-run', (w, webpackCb) => { + this.build.work(once(() => { + this.timer.start(); + this.logRunStart(); + webpackCb(); + })); + }); + + this.compiler.plugin('done', stats => { + if (!stats.hasErrors() && !stats.hasWarnings()) { + this.logRunSuccess(); + this.build.success(); + return; + } + + let err = this.failedStatsToError(stats); + this.logRunFailure(err); + this.build.failure(err); + this.watching.invalidate(); + }); + + this.watching = this.compiler.watch({ aggregateTimeout: 200 }, err => { + if (err) { + this.log('fatal', err); + process.exit(1); + } + }); + + let buildPromise = this.build.get(); + if (this.prebuild) await buildPromise; + + this.initializing = false; + this.log(['info', 'optimize'], { + tmpl: `Lazy optimization of ${this.bundles.desc()} ready`, + bundles: this.bundles.getIds() + }); + } + + async getPath(relativePath) { + await this.build.get(); + return join(this.compiler.outputPath, relativePath); + } + + bindToServer(server) { + server.route({ + path: '/bundles/{asset*}', + method: 'GET', + handler: async (request, reply) => { + try { + let path = await this.getPath(request.params.asset); + return reply.file(path); + } catch (error) { + console.log(error.stack); + return reply(error); + } + } + }); + } + + logRunStart() { + this.log(['info', 'optimize'], { + tmpl: `Lazy optimization started`, + bundles: this.bundles.getIds() + }); + } + + logRunSuccess() { + this.log(['info', 'optimize'], { + tmpl: 'Lazy optimization <%= status %> in <%= seconds %> seconds', + bundles: this.bundles.getIds(), + status: 'success', + seconds: this.timer.end() + }); + } + + logRunFailure(err) { + // errors during initialization to the server, unlike the rest of the + // errors produced here. Lets not muddy the console with extra errors + if (this.initializing) return; + + this.log(['fatal', 'optimize'], { + tmpl: 'Lazy optimization <%= status %> in <%= seconds %> seconds<%= err %>', + bundles: this.bundles.getIds(), + status: 'failed', + seconds: this.timer.end(), + err: err + }); + } +}; diff --git a/bin/optimize/lazy/LazyServer.js b/bin/optimize/lazy/LazyServer.js new file mode 100644 index 00000000000000..7527cf1505d515 --- /dev/null +++ b/bin/optimize/lazy/LazyServer.js @@ -0,0 +1,22 @@ + +let { Server } = require('hapi'); +let { fromNode } = require('bluebird'); +let Boom = require('boom'); + + +module.exports = class LazyServer { + constructor(host, port, optimizer) { + this.optimizer = optimizer; + this.server = new Server(); + this.server.connection({ + host: host, + port: port + }); + } + + async init() { + await this.optimizer.init(); + this.optimizer.bindToServer(this.server); + await fromNode(cb => this.server.start(cb)); + } +}; diff --git a/bin/optimize/lazy/WeirdControlFlow.js b/bin/optimize/lazy/WeirdControlFlow.js new file mode 100644 index 00000000000000..5825c12c93464c --- /dev/null +++ b/bin/optimize/lazy/WeirdControlFlow.js @@ -0,0 +1,58 @@ + +let { fromNode } = require('bluebird'); + +module.exports = class WeirdControlFlow { + constructor(work) { + this.handlers = []; + } + + get() { + return fromNode(cb => { + if (this.ready) return cb(); + this.handlers.push(cb); + this.start(); + }); + } + + work(work) { + this._work = work; + this.stop(); + + if (this.handlers.length) { + this.start(); + } + } + + start() { + if (this.running) return; + this.stop(); + if (this._work) { + this.running = true; + this._work(); + } + } + + stop() { + this.ready = false; + this.error = false; + this.running = false; + } + + success(...args) { + this.stop(); + this.ready = true; + this._flush(args); + } + + failure(err) { + this.stop(); + this.error = err; + this._flush([err]); + } + + _flush(args) { + for (let fn of this.handlers.splice(0)) { + fn.apply(null, args); + } + } +}; diff --git a/bin/optimize/lazy/lazy.js b/bin/optimize/lazy/lazy.js new file mode 100644 index 00000000000000..6d7d6541bcd629 --- /dev/null +++ b/bin/optimize/lazy/lazy.js @@ -0,0 +1,35 @@ +module.exports = async (kbnServer, server, config) => { + + let { isWorker } = require('cluster'); + + if (!isWorker) { + throw new Error(`lazy optimization is only available in "watch" mode`); + } + + /** + * When running in lazy mode two workers/threads run in one + * of the modes: 'optmzr' or 'server' + * + * optmzr: this thread runs the LiveOptimizer and the LazyServer + * which serves the LiveOptimizer's output and blocks requests + * while the optimizer is running + * + * server: this thread runs the entire kibana server and proxies + * all requests for /bundles/* to the optmzr + * + * @param {string} process.env.kbnWorkerType + */ + switch (process.env.kbnWorkerType) { + case 'optmzr': + await kbnServer.mixin(require('./optmzrRole')); + break; + + case 'server': + await kbnServer.mixin(require('./proxyRole')); + break; + + default: + throw new Error(`unknown kbnWorkerType "${process.env.kbnWorkerType}"`); + } + +}; diff --git a/bin/optimize/lazy/optmzrRole.js b/bin/optimize/lazy/optmzrRole.js new file mode 100644 index 00000000000000..6558fd50b70797 --- /dev/null +++ b/bin/optimize/lazy/optmzrRole.js @@ -0,0 +1,41 @@ +module.exports = async (kbnServer, kibanaHapiServer, config) => { + + let src = require('requirefrom')('src'); + let fromRoot = src('utils/fromRoot'); + let LazyServer = require('./LazyServer'); + let LazyOptimizer = require('./LazyOptimizer'); + + let server = new LazyServer( + config.get('optimize.lazyHost'), + config.get('optimize.lazyPort'), + new LazyOptimizer({ + log: (tags, data) => kibanaHapiServer.log(tags, data), + env: kbnServer.bundles.env, + bundles: kbnServer.bundles, + profile: config.get('optimize.profile'), + sourceMaps: config.get('optimize.sourceMaps'), + prebuild: config.get('optimize.lazyPrebuild'), + unsafeCache: config.get('optimize.unsafeCache'), + }) + ); + + + let ready = false; + + let sendReady = () => { + if (!process.connected) return; + process.send(['WORKER_BROADCAST', { optimizeReady: ready }]); + }; + + process.on('message', (msg) => { + if (msg && msg.optimizeReady === '?') sendReady(); + }); + + + sendReady(); + + await server.init(); + + ready = true; + sendReady(); +}; diff --git a/bin/optimize/lazy/proxyRole.js b/bin/optimize/lazy/proxyRole.js new file mode 100644 index 00000000000000..df13c68b8700bb --- /dev/null +++ b/bin/optimize/lazy/proxyRole.js @@ -0,0 +1,45 @@ +let { fromNode } = require('bluebird'); +let { get, once } = require('lodash'); + +module.exports = (kbnServer, server, config) => { + + server.route({ + path: '/bundles/{path*}', + method: 'GET', + handler: { + proxy: { + host: config.get('optimize.lazyHost'), + port: config.get('optimize.lazyPort'), + passThrough: true, + xforward: true + } + }, + config: {auth: false} + }); + + return fromNode(cb => { + let timeout = setTimeout(() => { + cb(new Error('Server timedout waiting for the optimizer to become ready')); + }, config.get('optimize.lazyProxyTimeout')); + + let waiting = once(() => { + server.log(['info', 'optimize'], 'Waiting for optimizer completion'); + }); + + if (!process.connected) return; + + process.send(['WORKER_BROADCAST', { optimizeReady: '?' }]); + process.on('message', (msg) => { + switch (get(msg, 'optimizeReady')) { + case true: + clearTimeout(timeout); + cb(); + break; + case false: + waiting(); + break; + } + }); + }); + +}; diff --git a/bin/testUtils/noDigestPromises.js b/bin/testUtils/noDigestPromises.js new file mode 100644 index 00000000000000..4b57a52f0acee3 --- /dev/null +++ b/bin/testUtils/noDigestPromises.js @@ -0,0 +1,38 @@ +var Bluebird = require('bluebird'); +require('ui/promises'); + +Bluebird.longStackTraces(); + +/** + * replace the Promise service with Bluebird so that tests + * can use promises without having to call $rootScope.apply() + * + * var noDigestPromises = require('testUtils/noDigestPromises'); + * + * describe('some module that does complex shit with promises', function () { + * beforeEach(noDigestPromises.activate); + * + * }); + */ + +var active = false; + +require('ui/modules') +.get('kibana') +.config(function ($provide) { + $provide.decorator('Promise', function ($delegate) { + return active ? Bluebird : $delegate; + }); +}); + +function activate() { active = true; } +function deactivate() { active = false; } + +module.exports = { + activate: activate, + deactivate: deactivate, + activateForSuite: function () { + before(activate); + after(deactivate); + } +}; diff --git a/bin/testUtils/simulateKeys.js b/bin/testUtils/simulateKeys.js new file mode 100644 index 00000000000000..ae3c6c0738b1b8 --- /dev/null +++ b/bin/testUtils/simulateKeys.js @@ -0,0 +1,106 @@ +define(function (require) { + var $ = require('jquery'); + var _ = require('lodash'); + var Promise = require('bluebird'); + var keyMap = require('ui/utils/key_map'); + var reverseKeyMap = _.mapValues(_.invert(keyMap), _.ary(_.parseInt, 1)); + var KeyboardEvent = window.KeyboardEvent; + + /** + * Simulate keyboard events in an element. This allows testing the way that + * elements respond to keyboard input. + * + * # sequence style + * keyboard events occur in a sequence, this array of events describe that sequence. + * + * ## event + * an object with a type property, or a string which will be turned into a single press + * + * ## event types + * ### press + * represents a key press + * - `key`: the key for the button pressed + * - `events`: optional list of events that occur before this press completes + * + * ### wait + * represents a pause in a sequence + * - `ms`: the number of milliseconds that the pause takes + * + * ### repeat + * represents a key being repeated because it is held down. Should only exist as a + * sub event of `press` events. + * - `count`: the number of times the repeat occurs + * + * @param {element} $el - jQuery element where events should occur + * @param {[type]} sequence - an array of events + * @async + */ + return function ($el, sequence) { + var modifierState = { + ctrlKey: false, + shiftKey: false, + altKey: false, + metaKey: false + }; + + return doList(_.clone(sequence)); + + function setModifier(key, state) { + var name = key + 'Key'; + if (modifierState.hasOwnProperty(name)) { + modifierState[name] = !!state; + } + } + + function doList(list) { + return Promise.try(function () { + if (!list || !list.length) return; + + var event = list[0]; + if (_.isString(event)) { + event = { type: 'press', key: event }; + } + + switch (event.type) { + case 'press': + return Promise.resolve() + .then(_.partial(fire, 'keydown', event.key)) + .then(_.partial(fire, 'keypress', event.key)) + .then(_.partial(doList, event.events)) + .then(_.partial(fire, 'keyup', event.key)); + + case 'wait': + return Promise.delay(event.ms); + + case 'repeat': + return (function again(remaining) { + if (!remaining) return Promise.resolve(); + remaining = remaining - 1; + return Promise.resolve() + .then(_.partial(fire, 'keydown', event.key, true)) + .then(_.partial(fire, 'keypress', event.key, true)) + .then(_.partial(again, remaining)); + }(event.count)); + + default: + throw new TypeError('invalid event type "' + event.type + '"'); + } + }) + .then(function () { + if (_.size(list) > 1) return doList(list.slice(1)); + }); + } + + function fire(type, key, repeat) { + var keyCode = reverseKeyMap[key]; + if (!keyCode) throw new TypeError('invalid key "' + key + '"'); + + if (type === 'keydown') setModifier(key, true); + if (type === 'keyup') setModifier(key, false); + + var $target = _.isFunction($el) ? $el() : $el; + var $event = new $.Event(type, _.defaults({ keyCode: keyCode }, modifierState)); + $target.trigger($event); + } + }; +}); diff --git a/bin/testUtils/stubIndexPattern.js b/bin/testUtils/stubIndexPattern.js new file mode 100644 index 00000000000000..a4338c9b553ed7 --- /dev/null +++ b/bin/testUtils/stubIndexPattern.js @@ -0,0 +1,46 @@ +define(function (require) { + return function (Private) { + var _ = require('lodash'); + var sinon = require('sinon'); + var Promise = require('bluebird'); + var IndexedArray = require('ui/IndexedArray'); + var IndexPattern = require('ui/index_patterns/_index_pattern'); + var fieldFormats = Private(require('ui/registry/field_formats')); + var flattenHit = Private(require('ui/index_patterns/_flatten_hit')); + var formatHit = require('ui/index_patterns/_format_hit'); + var getComputedFields = require('ui/index_patterns/_get_computed_fields'); + + var Field = Private(require('ui/index_patterns/_field')); + + function StubIndexPattern(pattern, timeField, fields) { + this.id = pattern; + this.popularizeField = sinon.spy(); + this.timeFieldName = timeField; + this.getNonScriptedFields = sinon.spy(); + this.getScriptedFields = sinon.spy(); + this.metaFields = ['_id', '_type', '_source']; + this.fieldFormatMap = {}; + this.routes = IndexPattern.prototype.routes; + + this.toIndexList = _.constant(Promise.resolve([pattern])); + this.getComputedFields = _.bind(getComputedFields, this); + this.flattenHit = flattenHit(this); + this.formatHit = formatHit(this, fieldFormats.getDefaultInstance('string')); + this.formatField = this.formatHit.formatField; + + this._indexFields = function () { + this.fields = new IndexedArray({ + index: ['name'], + group: ['type'], + initialSet: fields.map(function (field) { + return new Field(this, field); + }, this) + }); + }; + + this._indexFields(); + } + + return StubIndexPattern; + }; +}); diff --git a/src/plugins/esProxyAuth/index.js b/src/plugins/esProxyAuth/index.js new file mode 100755 index 00000000000000..9d670f2317506d --- /dev/null +++ b/src/plugins/esProxyAuth/index.js @@ -0,0 +1,45 @@ +let _ = require('lodash'); +let Promise = require('bluebird'); +let strategyMap = require('../../server/auth/lib/authStrategyMap'); +let name = 'esProxy'; + +module.exports = (kibana) => new kibana.Plugin({ + require: ['elasticsearch'], + init(server, options) { + let config = server.config(); + if (!config.get('auth.enabled') || config.get('auth.strategy') !== name) return; + let esPlugin = server.plugins.elasticsearch; + + strategyMap.set(name, { + authenticate(request, username, password) { + return isValid(username, password).then(() => ({ + username: username, + password: password + })); + }, + + validate(request, session) { + // Is it overkill to make this request on every request? + return isValid(session.username, session.password).then(() => { + _.assign(request.headers, getAuthHeader(session.username, session.password)); + return true; + }); + } + }); + + function isValid(username, password) { + return Promise.try(() => { + if (esPlugin.status.state !== 'green') throw new Error('Elasticsearch client is not ready.'); + + return esPlugin.client.info({ + headers: getAuthHeader(username, password) + }); + }); + } + + function getAuthHeader(username, password) { + let auth = new Buffer(`${username}:${password}`, 'utf8').toString('base64'); + return {'Authorization': `Basic ${auth}`}; + } + } +}); \ No newline at end of file diff --git a/src/plugins/esProxyAuth/package.json b/src/plugins/esProxyAuth/package.json new file mode 100755 index 00000000000000..3c835c4b0ea90b --- /dev/null +++ b/src/plugins/esProxyAuth/package.json @@ -0,0 +1,4 @@ +{ + "name": "esProxyAuth", + "version": "1.0.0" +} \ No newline at end of file diff --git a/src/plugins/htpasswdAuth/index.js b/src/plugins/htpasswdAuth/index.js new file mode 100755 index 00000000000000..29f7ce347532c6 --- /dev/null +++ b/src/plugins/htpasswdAuth/index.js @@ -0,0 +1,59 @@ +let fs = require('fs'); +let Promise = require('bluebird'); +let htpasswd = require('htpasswd'); +let strategyMap = require('../../server/auth/lib/authStrategyMap'); +let name = 'htpasswd'; + +module.exports = (kibana) => new kibana.Plugin({ + config(Joi) { + return Joi.object({ + enabled: Joi.boolean().default(true), + path: Joi.string() + }).default(); + }, + + init(server, options) { + let config = server.config(); + if (!config.get('auth.enabled') || config.get('auth.strategy') !== name) return; + let path = config.get('htpasswdAuth.path'); + let users = new Map(); + + let initialized = Promise.promisify(fs.readFile)(path).then((data) => { + let lines = String(data) + .replace(/\\r\\n/g, '\n') + .split('\n'); + + lines.forEach(function (line) { + let parts = line.split(':'); + if (parts.length !== 2) return; + + let username = parts.shift(); + let hash = parts.shift(); + users.set(username, hash); + }); + }); + + strategyMap.set('htpasswd', { + authenticate(request, username, password) { + return isValid(username, password).then(function () { + return { + username: username, + password: password + }; + }); + }, + + validate(request, session) { + return isValid(session.username, session.password); + } + }); + + function isValid(username, password) { + return initialized.then(function () { + let hash = users.get(username); + if (hash == null || !htpasswd.verify(hash, password)) return Promise.reject(false); + return Promise.resolve(true); + }); + } + } +}); \ No newline at end of file diff --git a/src/plugins/htpasswdAuth/package.json b/src/plugins/htpasswdAuth/package.json new file mode 100755 index 00000000000000..107ab9d194911c --- /dev/null +++ b/src/plugins/htpasswdAuth/package.json @@ -0,0 +1,4 @@ +{ + "name": "htpasswdAuth", + "version": "1.0.0" +} \ No newline at end of file diff --git a/src/server/auth/index.js b/src/server/auth/index.js index a0c24a37b10d40..56d62f3c370353 100755 --- a/src/server/auth/index.js +++ b/src/server/auth/index.js @@ -1,11 +1,136 @@ let _ = require('lodash'); -let Bcrypt = require('bcrypt'); +let Boom = require('boom'); +let Joi = require('joi'); +let hapiAuthCookie = require('hapi-auth-cookie'); +let strategyMap = require('./lib/authStrategyMap'); + +/* let Hapi = require('hapi'); +let Bcrypt = require('bcrypt'); let Basic = require('hapi-auth-basic'); +*/ module.exports = (kbnServer, server, config) => { - - var users = { + + var authorization=null; + + const scheme = function (server, options) { + + return { + authenticate: function (request, reply) { + + const req = request.raw.req; + // const authorization = req.headers.authorization; + // console.log("authorization"); + // console.log(authorization); + //console.log(req.headers.cookie.data); + + + //let session = request.state.session; + console.log(req.states); + if (!authorization) { + return reply.redirect('/login'); + // return reply(Boom.unauthorized(null, 'Custom')); + } + return reply.continue({ credentials: { user: 'john' } }); + } + }; + }; + server.auth.scheme('custom', scheme); + server.state('data', { + ttl: null, + isSecure: true, + isHttpOnly: true, + encoding: 'base64json', + clearInvalid: false, // remove invalid cookies + strictHeader: true // don't allow violations of RFC 6265 + }); + + server.state('session', { + ttl: 24 * 60 * 60 * 1000, // One day + isSecure: true, + path: '/', + encoding: 'base64json' + }); + + let name = config.get('auth.strategy'); + let strategy = strategyMap.get(name); + if (strategy == null) throw new Error(`There is no registered authentication strategy with the name "${name}".`); + if (_.isFunction(strategy.init)) strategy.init(server); + + server.register(hapiAuthCookie, function (err) { + if (err) { + throw err; + } + + let options = { + cookie: 'sid', + password: config.get('auth.encryptionKey'), + ttl: config.get('auth.sessionTimeout'), + clearInvalid: true, + isHttpOnly: false, + keepAlive: true, + isSecure: true + }; + + if (_.isFunction(strategy.validate)) { + options.validateFunc = (request, session, callback) => strategy.validate(request, session).nodeify(callback); + } + server.auth.strategy('session', 'custom', 'required', options); + + }); + + + server.route({ + method: 'POST', + path: '/login', + handler(request, reply) { + strategy.authenticate(request, request.payload.username, request.payload.password) + .then((credentials) => { + // request.auth.session.set(credentials); + // console.log("login success:"); + // console.log(credentials); + //reply('Hello').state('data', { firstVisit: false }); + authorization=credentials; + //server.log(['error', 'database', 'read']); + + let session = request.state.session; + if (!session) { + session = { user: 'joe' }; + } + session.last = Date.now(); + + // console.log(request.session); + return reply('Success').state('session', session).redirect("./app/kibana"); + // return reply('cookie').state('data', { firstVisit: false }).redirect("./app/kibana"); + + }, (error) => { + // request.auth.session.clear(); + reply(Boom.unauthorized(error)); + }); + }, + config: { + auth: false, + validate: { + payload: { + username: Joi.string().required(), + password: Joi.string().required() + } + } + } + }); + + server.route({ + method: 'GET', + path: '/logout', + handler(request, reply) { + request.auth.session.clear(); + return reply.redirect('/'); + } + }); + + /* + var users = { john: { username: 'john', password: '$2a$10$iqJSHD.BGr0E2IxQwYgJmeP3NvhPrXAeLSaGCj6IR/XU5QtjVu5Tm', // 'secret' @@ -24,20 +149,120 @@ module.exports = (kbnServer, server, config) => { callback(err, isValid, { id: user.id, name: user.name }); }); }; - + server.register(Basic, function (err) { + let options = { + cookie: 'sid', + clearInvalid: true, + isHttpOnly: false, + keepAlive: true, + isSecure: true, + redirectTo: '/login', + validateFunc: validate + }; - server.auth.strategy('simple', 'basic', { validateFunc: validate }); - server.route({ - method: 'GET', + server.auth.strategy('simple', 'basic', options); + }); + + server.route({ + method: 'POST', path: '/login', config: { auth: 'simple', handler: function (request, reply) { + console.log(request.payload) return reply.redirect('./app/kibana'); } } }); - }); -}; \ No newline at end of file + server.route({ + method: 'GET', + path: '/logout', + handler(request, reply) { + try{ + request.auth.session.clear(); + }catch (e){ + + } + return reply.redirect('/login'); + } + }); + */ + + + + + /* + if (!config.get('auth.enabled')) return; + let name = config.get('auth.strategy'); + let strategy = strategyMap.get(name); + // console.log(strategy); + if (strategy == null) throw new Error(`There is no registered authentication strategy with the name "${name}".`); + if (_.isFunction(strategy.init)) strategy.init(server); + + server.register(hapiAuthCookie, (error) => { + if (error != null) throw error; + + // console.log(hapiAuthCookie); + let options = { + cookie: 'sid', + password: config.get('auth.encryptionKey'), + ttl: config.get('auth.sessionTimeout'), + clearInvalid: true, + isHttpOnly: false, + keepAlive: true, + isSecure: true, + redirectTo: '/login' + }; + + if (_.isFunction(strategy.validate)) { + options.validateFunc = (request, session, callback) => strategy.validate(request, session).nodeify(callback); + } + server.auth.strategy('session', 'cookie', 'required', options); + }); + + server.route({ + method: 'POST', + path: '/login', + handler(request, reply) { + strategy.authenticate(request, request.payload.username, request.payload.password) + .then((credentials) => { + request.auth.session.set(credentials); + + // add by darcy + request.auth.credentials=credentials; + request.auth.isAuthenticated=true; + // console.log("login success:"); + // console.log(credentials); + console.log(request.auth); + return reply.redirect("./app/kibana"); + // reply.file('../../plugins/login/login.html'); + + }, (error) => { + request.auth.session.clear(); + reply(Boom.unauthorized(error)); + }); + }, + config: { + auth: false, + validate: { + payload: { + username: Joi.string().required(), + password: Joi.string().required() + } + } + } + }); + + + server.route({ + method: 'GET', + path: '/logout', + handler(request, reply) { + request.auth.session.clear(); + return reply.redirect('/'); + } + });*/ +}; + diff --git a/tasks/build/index.js_bak b/tasks/build/index.js_bak new file mode 100644 index 00000000000000..22341871639d8b --- /dev/null +++ b/tasks/build/index.js_bak @@ -0,0 +1,31 @@ +module.exports = function (grunt) { + let { flatten } = require('lodash'); + + grunt.registerTask('build', flatten([ + '_build:getProps', + 'clean:build', + 'clean:target', + '_build:downloadNodeBuilds:start', + 'copy:devSource', + 'babel:build', + '_build:babelOptions', + '_build:installedPlugins', + '_build:packageJson', + '_build:readme', + '_build:installNpmDeps', + '_build:removePkgJsonDeps', + 'clean:testsFromModules', + 'clean:deepModuleBins', + 'clean:deepModules', + 'run:optimizeBuild', + 'stop:optimizeBuild', + '_build:downloadNodeBuilds:finish', + '_build:versionedLinks', + '_build:archives', + !grunt.option('os-packages') ? [] : [ + '_build:pleaseRun', + '_build:osPackages', + ], + '_build:shasums' + ])); +};