Initial commit

Change-Id: I2d68bef99e793214347a3b62ca717ab21d5d15c1
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9f11b75
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.idea/
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..60ac488
--- /dev/null
+++ b/README.md
@@ -0,0 +1,73 @@
+# Kibana Dashboard
+
+The goal of this project is to provide the tools to manage and configure a kibana dashboard
+aimed to visualize analytics on project contributions.
+Kibana configuration is maintained in elasticsearch so, in reality, this project will talk to the elasticsearch
+instance which kibana is connected to.
+
+For the time being, this project allows to configure only one type of dashboard:
+
+* **Git Commits Dashboard**:
+which is able to display data produced by the execution of the [GIT commits ETL](https://github.com/GerritCodeReview/apps_analytics-etl#git-commits) analytics ETL
+ 
+
+## Getting Started
+
+To get you running in no time, this project also provides a way to spin up a local environment with elasticsearch and kibana:
+
+```bash
+cd local_environment
+docker-compose up
+
+```
+
+this will start:
+* elasticsearch, bound and exposing port 9200 and 9300
+* kibana, bound and exposing port 5601
+
+### Prerequisites
+
+* [docker](https://www.docker.com/)
+* [docker-compose](https://docs.docker.com/compose/)
+* [make](https://www.gnu.org/software/make/)
+
+## Restore kibana configuration
+To configure a kibana dashboard you can simply point the setup script to the target elasticsearch as follows
+
+```make restore [ELASTICSEARCH_URL] [ELASTICSEARCH_PORT]```
+
+* ELASTICSEARCH_URL: default is `http://host.docker.internal` (the current host running docker)
+* ELASTICSEARCH_PORT: default is 9200
+
+For example to configure kibana spinned up via local environment you can simply run:
+```bash
+cd analytics-setup
+make restore
+```
+
+Just browse to `http://localhost:5601` to see the configured dashboard.
+
+At this point the dashboard will still be empty.
+If you want to populate it with data you might want to run the [GIT commits ETL](https://github.com/GerritCodeReview/apps_analytics-etl#git-commits)
+
+## Dump kibana configuration
+
+If you make some changes to kibana and you want to dump them on disk for later use you can
+just run:
+
+```make dump [ELASTICSEARCH_URL] [ELASTICSEARCH_PORT]```
+
+* ELASTICSEARCH_URL: default is `http://host.docker.internal` (the current host running docker)
+* ELASTICSEARCH_PORT: default is 9200
+
+For example to dump the configuration of kibana spinned up via local environment you can simply run:
+```bash
+cd analytics-setup
+make dump
+```
+
+This will save any changes to ```kibana-config/analytics-settings-dashboards-visualizations.data.json```
+
+## License
+
+This project is licensed under the Apache License, Version 2.0 License - see the [LICENSE](LICENSE) file for details
diff --git a/analytics-setup/Dockerfile b/analytics-setup/Dockerfile
new file mode 100644
index 0000000..08dad7d
--- /dev/null
+++ b/analytics-setup/Dockerfile
@@ -0,0 +1,9 @@
+FROM taskrabbit/elasticsearch-dump:v3.3.1
+
+RUN apk add --no-cache curl
+
+COPY docker-entrypoint.sh wait-for-elasticsearch /
+COPY ./elasticsearch-config/ /elasticsearch-config/
+COPY ./kibana-config/ /kibana-config/
+
+ENTRYPOINT /docker-entrypoint.sh
diff --git a/analytics-setup/Makefile b/analytics-setup/Makefile
new file mode 100644
index 0000000..369cfe4
--- /dev/null
+++ b/analytics-setup/Makefile
@@ -0,0 +1,38 @@
+# Copyright (C) 2019 GerritForge Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+RESTORER_IMG = kibana-dashboard-importer
+DUMPER_IMG = taskrabbit/elasticsearch-dump
+
+ELASTICSEARCH_URL=http://host.docker.internal
+ELASTICSEARCH_PORT=9200
+
+.PHONY: build restore
+
+build:
+	docker build --no-cache -t $(RESTORER_IMG) .
+restore: build
+	docker run --rm -it \
+		-e ELASTICSEARCH_URL=$(ELASTICSEARCH_URL) \
+		-e ELASTICSEARCH_PORT=$(ELASTICSEARCH_PORT) \
+		$(RESTORER_IMG)
+dump: build
+	docker run --rm -it \
+	        -e ELASTICSEARCH_URL=$(ELASTICSEARCH_URL) \
+		-e ELASTICSEARCH_PORT=$(ELASTICSEARCH_PORT) \
+                $(DUMPER_IMG) \
+		--input='$(ELASTICSEARCH_URL):$(ELASTICSEARCH_PORT)/.kibana' \
+		--output=$$ \
+		--type=data \
+	> ./kibana-config/analytics-settings-dashboards-visualizations.data.json
diff --git a/analytics-setup/docker-entrypoint.sh b/analytics-setup/docker-entrypoint.sh
new file mode 100755
index 0000000..31ed2b3
--- /dev/null
+++ b/analytics-setup/docker-entrypoint.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# Copyright (C) 2019 GerritForge Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+/wait-for-elasticsearch
+
+echo "* * * * Create elasticsearch indexes @ $ELASTICSEARCH_URL:$ELASTICSEARCH_PORT * * * *"
+for file in `ls -v /elasticsearch-config/*.json`; do
+	echo "--> $file";
+	index_template_name=$(basename $file .json)
+	index_name="${index_template_name}_initial"
+	curl -X PUT -v -H 'Content-Type: application/json' \
+        -d @$file $ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/_template/$index_template_name
+
+	echo "* * * * Creating $index_name index * * * *"
+	curl -XPUT "$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/$index_name?pretty" -H 'Content-Type: application/json'
+
+    curl -XPOST "$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/_aliases" -H 'Content-Type: application/json' -d"{\"actions\" : [
+            { \"add\" : { \"index\" : \"$index_name\", \"alias\" : \"$index_template_name\" } }
+        ]
+    }"
+
+done;
+
+echo "* * * * Input kibana settings @ $ELASTICSEARCH_URL:$ELASTICSEARCH_PORT * * * *"
+for file in `ls -v /kibana-config/*.data.json`; do
+       echo "--> $file";
+        /usr/lib/node_modules/elasticdump/bin/elasticdump \
+            --output=$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/.kibana \
+            --input=$file \
+            --type=data \
+            --headers '{"Content-Type": "application/json"}';
+done;
diff --git a/analytics-setup/elasticsearch-config/gitcommits.json b/analytics-setup/elasticsearch-config/gitcommits.json
new file mode 100644
index 0000000..6679f27
--- /dev/null
+++ b/analytics-setup/elasticsearch-config/gitcommits.json
@@ -0,0 +1,102 @@
+{
+  "index_patterns": [
+    "gitcommits*"
+  ],
+  "settings": {
+    "index": {
+      "number_of_shards": "1"
+    }
+  },
+  "mappings": {
+    "gitCommits": {
+      "_source": {
+        "enabled": true
+      },
+      "properties": {
+        "added_lines": {
+          "type": "long"
+        },
+        "author": {
+          "type": "text",
+          "fields": {
+            "keyword": {
+              "type": "keyword",
+              "ignore_above": 256
+            }
+          }
+        },
+        "branches": {
+          "type": "text",
+          "fields": {
+            "keyword": {
+              "type": "keyword",
+              "ignore_above": 256
+            }
+          }
+        },
+        "day": {
+          "type": "long"
+        },
+        "deleted_lines": {
+          "type": "long"
+        },
+        "email": {
+          "type": "text",
+          "fields": {
+            "keyword": {
+              "type": "keyword",
+              "ignore_above": 256
+            }
+          }
+        },
+        "hour": {
+          "type": "long"
+        },
+        "is_bot_like": {
+          "type": "boolean"
+        },
+        "is_merge": {
+          "type": "boolean"
+        },
+        "last_commit_date": {
+          "type": "date",
+          "format": "epoch_millis"
+        },
+        "month": {
+          "type": "long"
+        },
+        "num_commits": {
+          "type": "long"
+        },
+        "num_distinct_files": {
+          "type": "long"
+        },
+        "num_files": {
+          "type": "long"
+        },
+        "organization": {
+          "type": "text",
+          "fields": {
+            "keyword": {
+              "type": "keyword",
+              "ignore_above": 256
+            }
+          }
+        },
+        "project": {
+          "type": "text",
+          "fields": {
+            "keyword": {
+              "type": "keyword",
+              "ignore_above": 256
+            }
+          }
+        },
+        "year": {
+          "type": "long"
+        }
+      }
+    }
+  },
+  "aliases": {}
+}
diff --git a/analytics-setup/kibana-config/analytics-settings-dashboards-visualizations.data.json b/analytics-setup/kibana-config/analytics-settings-dashboards-visualizations.data.json
new file mode 100644
index 0000000..3cd4db3
--- /dev/null
+++ b/analytics-setup/kibana-config/analytics-settings-dashboards-visualizations.data.json
@@ -0,0 +1,14 @@
+{"_index":".kibana_1","_type":"doc","_id":"space:default","_score":1,"_source":{"space":{"name":"Default","description":"This is your default space!","color":"#00bfb3","_reserved":true},"type":"space","updated_at":"2019-01-29T10:21:51.206Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"config:6.5.4","_score":1,"_source":{"config":{"buildNum":18878,"defaultIndex":"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3"},"type":"config","updated_at":"2019-01-30T12:06:22.370Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"telemetry:telemetry","_score":1,"_source":{"telemetry":{"enabled":false},"type":"telemetry","updated_at":"2019-01-29T10:25:37.748Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:3847de90-23f3-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - Authors activity over the years","visState":"{\"title\":\"GIT Commits - Authors activity over the years\",\"type\":\"heatmap\",\"params\":{\"type\":\"heatmap\",\"addTooltip\":true,\"addLegend\":true,\"enableHover\":false,\"legendPosition\":\"right\",\"times\":[],\"colorsNumber\":10,\"colorSchema\":\"Blues\",\"setColorRange\":false,\"colorsRange\":[],\"invertColors\":false,\"percentageMode\":false,\"valueAxes\":[{\"show\":false,\"id\":\"ValueAxis-1\",\"type\":\"value\",\"scale\":{\"type\":\"linear\",\"defaultYExtents\":true},\"labels\":{\"show\":false,\"rotate\":0,\"overwriteColor\":false,\"color\":\"#555\"}}]},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"last_commit_date\",\"timeRange\":{\"from\":\"now-5y\",\"to\":\"now\",\"mode\":\"quick\"},\"useNormalizedEsInterval\":true,\"interval\":\"y\",\"time_zone\":\"Europe/London\",\"drop_partials\":false,\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"group\",\"params\":{\"field\":\"author.keyword\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Author\"}}]}","uiStateJSON":"{\"vis\":{\"defaultColors\":{\"2 - 79\":\"rgb(247,251,255)\",\"79 - 156\":\"rgb(227,238,249)\",\"156 - 233\":\"rgb(208,225,242)\",\"233 - 310\":\"rgb(182,212,233)\",\"310 - 386\":\"rgb(148,196,223)\",\"386 - 463\":\"rgb(107,174,214)\",\"463 - 540\":\"rgb(74,152,201)\",\"540 - 617\":\"rgb(46,126,188)\",\"617 - 694\":\"rgb(23,100,171)\",\"694 - 770\":\"rgb(8,74,145)\"}}}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T18:25:13.977Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:01062ff0-23bb-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - commits over time","visState":"{\"title\":\"GIT Commits - commits over time\",\"type\":\"histogram\",\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":true,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"truncate\":100},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":100},\"title\":{\"text\":\"#Commits\"}}],\"seriesParams\":[{\"show\":\"true\",\"type\":\"histogram\",\"mode\":\"stacked\",\"data\":{\"label\":\"#Commits\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"showCircles\":true}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"last_commit_date\",\"timeRange\":{\"from\":\"now-5y\",\"to\":\"now\",\"mode\":\"quick\"},\"useNormalizedEsInterval\":true,\"interval\":\"auto\",\"time_zone\":\"Europe/London\",\"drop_partials\":false,\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}}]}","uiStateJSON":"{\"vis\":{\"legendOpen\":true}}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T11:43:38.008Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:61f1dc90-24b2-11e9-b0b6-4f50aa82b6fb","_score":1,"_source":{"visualization":{"title":"GIT Commits - Authors Stats","visState":"{\"title\":\"GIT Commits - Authors Stats\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":true,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"organization.keyword\",\"customLabel\":\"#Organizations\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"project.keyword\",\"customLabel\":\"#Projects\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"added_lines\",\"customLabel\":\"#Added Lines\"}},{\"id\":\"5\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"deleted_lines\",\"customLabel\":\"#Deleted Lines\"}},{\"id\":\"6\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"num_files\",\"customLabel\":\"AVG #Files\"}},{\"id\":\"7\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"changes_per_commit\",\"customLabel\":\"AVG #Changes per commit\"}},{\"id\":\"8\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"author.keyword\",\"size\":9,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":true,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Author\"}}]}","uiStateJSON":"{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-30T17:13:37.753Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:5ba41ad0-23f2-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - Organization Stats","visState":"{\"title\":\"GIT Commits - Organization Stats\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":true,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"author.keyword\",\"customLabel\":\"#Authors\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"project.keyword\",\"customLabel\":\"#Projects\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"added_lines\",\"customLabel\":\"#Added Lines\"}},{\"id\":\"5\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"deleted_lines\",\"customLabel\":\"#Deleted Lines\"}},{\"id\":\"6\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"num_files\",\"customLabel\":\"AVG #Files\"}},{\"id\":\"7\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"changes_per_commit\",\"customLabel\":\"AVG #Changes per commit\"}},{\"id\":\"8\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"organization.keyword\",\"size\":9,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":true,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Organization\"}}]}","uiStateJSON":"{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T18:32:06.348Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:730ecdb0-23ba-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - Overall Statistics","visState":"{\"title\":\"GIT Commits - Overall Statistics\",\"type\":\"metric\",\"params\":{\"addTooltip\":true,\"addLegend\":false,\"type\":\"metric\",\"metric\":{\"percentageMode\":false,\"useRanges\":false,\"colorSchema\":\"Green to Red\",\"metricColorMode\":\"None\",\"colorsRange\":[{\"from\":0,\"to\":100}],\"labels\":{\"show\":true},\"invertColors\":false,\"style\":{\"bgFill\":\"#000\",\"bgColor\":false,\"labelColor\":false,\"subText\":\"\",\"fontSize\":46}}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"project.keyword\",\"customLabel\":\"#Projects\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"author.keyword\",\"customLabel\":\"#Authors\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"organization.keyword\",\"customLabel\":\"#Organizations\"}}]}","uiStateJSON":"{}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T11:38:51.275Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:0078d480-23f1-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - Commits per Organization","visState":"{\"title\":\"GIT Commits - Commits per Organization\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":false,\"labels\":{\"show\":true,\"values\":true,\"last_level\":true,\"truncate\":100}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"organization.keyword\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":true,\"otherBucketLabel\":\"Other\",\"missingBucket\":true,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Organization\"}}]}","uiStateJSON":"{}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T18:10:21.666Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:31c47580-23f1-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - Commits per Author","visState":"{\"title\":\"GIT Commits - Commits per Author\",\"type\":\"pie\",\"params\":{\"type\":\"pie\",\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"isDonut\":false,\"labels\":{\"show\":true,\"values\":true,\"last_level\":true,\"truncate\":100}},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"segment\",\"params\":{\"field\":\"author.keyword\",\"size\":10,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":true,\"otherBucketLabel\":\"Other\",\"missingBucket\":true,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Author\"}}]}","uiStateJSON":"{}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T18:10:44.056Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:7d9b8c60-23f0-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"visualization":{"title":"GIT Commits - Project Stats","visState":"{\"title\":\"GIT Commits - Project Stats\",\"type\":\"table\",\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"sort\":{\"columnIndex\":null,\"direction\":null},\"showTotal\":true,\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"author.keyword\",\"customLabel\":\"#Authors\"}},{\"id\":\"2\",\"enabled\":true,\"type\":\"cardinality\",\"schema\":\"metric\",\"params\":{\"field\":\"organization.keyword\",\"customLabel\":\"#Organizations\"}},{\"id\":\"3\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"num_commits\",\"customLabel\":\"#Commits\"}},{\"id\":\"4\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"added_lines\",\"customLabel\":\"#Added Lines\"}},{\"id\":\"5\",\"enabled\":true,\"type\":\"sum\",\"schema\":\"metric\",\"params\":{\"field\":\"deleted_lines\",\"customLabel\":\"#Deleted Lines\"}},{\"id\":\"6\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"num_files\",\"customLabel\":\"AVG #Files\"}},{\"id\":\"7\",\"enabled\":true,\"type\":\"avg\",\"schema\":\"metric\",\"params\":{\"field\":\"changes_per_commit\",\"customLabel\":\"AVG #Changes per commit\"}},{\"id\":\"8\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"project.keyword\",\"size\":9,\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":true,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"Project\"}}]}","uiStateJSON":"{\"vis\":{\"params\":{\"sort\":{\"columnIndex\":null,\"direction\":null}}}}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-01-29T18:31:26.647Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"visualization:3b1805b0-4c9c-11e9-abc0-6368ea6bca2f","_score":1,"_source":{"visualization":{"title":"GIT Commits - bot-like commits","visState":"{\"aggs\":[{\"enabled\":true,\"id\":\"1\",\"params\":{\"customLabel\":\"#Commits\",\"field\":\"num_commits\"},\"schema\":\"metric\",\"type\":\"sum\"},{\"enabled\":true,\"id\":\"2\",\"params\":{\"customLabel\":\"Bot-like commit\",\"field\":\"is_bot_like\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"order\":\"desc\",\"orderBy\":\"1\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"size\":2},\"schema\":\"segment\",\"type\":\"terms\"}],\"params\":{\"addLegend\":true,\"addTooltip\":true,\"isDonut\":true,\"labels\":{\"last_level\":true,\"show\":true,\"truncate\":100,\"values\":true},\"legendPosition\":\"right\",\"type\":\"pie\"},\"title\":\"GIT Commits - bot-like commits\",\"type\":\"pie\"}","uiStateJSON":"{}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[]}"}},"type":"visualization","updated_at":"2019-03-22T12:28:38.496Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"index-pattern:7d9fb770-23b6-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"index-pattern":{"title":"gitcommits","timeFieldName":"last_commit_date","fields":"[{\"name\":\"_id\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_index\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"_score\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_source\",\"type\":\"_source\",\"count\":0,\"scripted\":false,\"searchable\":false,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"_type\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false},{\"name\":\"added_lines\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"author\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"author.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"branches\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"branches.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"day\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"deleted_lines\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"email\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"email.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"hour\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"is_bot_like\",\"type\":\"boolean\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"is_merge\",\"type\":\"boolean\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"last_commit_date\",\"type\":\"date\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"month\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"num_commits\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"num_distinct_files\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"num_files\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"organization\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"organization.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"project\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":false,\"readFromDocValues\":false},{\"name\":\"project.keyword\",\"type\":\"string\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"year\",\"type\":\"number\",\"count\":0,\"scripted\":false,\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":true},{\"name\":\"changes_per_commit\",\"type\":\"number\",\"count\":0,\"scripted\":true,\"script\":\"if (doc['num_commits'].value > 0) { \\n    return ((float) (doc['added_lines'].value + doc['deleted_lines'].value) / (float) doc['num_commits'].value);\\n} else {\\n    return 0;\\n}\",\"lang\":\"painless\",\"searchable\":true,\"aggregatable\":true,\"readFromDocValues\":false}]","fieldFormatMap":"{\"changes_per_commit\":{}}"},"type":"index-pattern","migrationVersion":{"index-pattern":"6.5.0"},"updated_at":"2019-03-22T13:08:47.406Z"}}

+{"_index":".kibana_1","_type":"doc","_id":"dashboard:f8f0c720-23b6-11e9-ae14-1dc4e23b60c3","_score":1,"_source":{"dashboard":{"title":"Git Commits dashboard","hits":0,"description":"","panelsJSON":"[{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":6,\"i\":\"1\"},\"id\":\"730ecdb0-23ba-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"1\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":24,\"w\":35,\"h\":20,\"i\":\"2\"},\"id\":\"7d9b8c60-23f0-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"2\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":24,\"y\":44,\"w\":24,\"h\":18,\"i\":\"4\"},\"id\":\"0078d480-23f1-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"4\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":44,\"w\":24,\"h\":18,\"i\":\"5\"},\"id\":\"31c47580-23f1-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"5\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":24,\"y\":62,\"w\":24,\"h\":20,\"i\":\"6\"},\"id\":\"5ba41ad0-23f2-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"6\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":82,\"w\":48,\"h\":21,\"i\":\"7\"},\"id\":\"3847de90-23f3-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"7\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{\"vis\":{\"legendOpen\":false}},\"gridData\":{\"x\":0,\"y\":6,\"w\":48,\"h\":18,\"i\":\"8\"},\"id\":\"01062ff0-23bb-11e9-ae14-1dc4e23b60c3\",\"panelIndex\":\"8\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"gridData\":{\"x\":0,\"y\":62,\"w\":24,\"h\":20,\"i\":\"9\"},\"version\":\"6.5.4\",\"panelIndex\":\"9\",\"type\":\"visualization\",\"id\":\"61f1dc90-24b2-11e9-b0b6-4f50aa82b6fb\",\"embeddableConfig\":{}},{\"gridData\":{\"x\":35,\"y\":24,\"w\":13,\"h\":20,\"i\":\"10\"},\"version\":\"6.5.4\",\"panelIndex\":\"10\",\"type\":\"visualization\",\"id\":\"3b1805b0-4c9c-11e9-abc0-6368ea6bca2f\",\"embeddableConfig\":{\"vis\":{\"legendOpen\":false}}}]","optionsJSON":"{\"darkTheme\":false,\"hidePanelTitles\":false,\"useMargins\":true}","version":1,"timeRestore":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[{\"meta\":{\"index\":\"7d9fb770-23b6-11e9-ae14-1dc4e23b60c3\",\"negate\":false,\"disabled\":false,\"alias\":null,\"type\":\"phrase\",\"key\":\"is_merge\",\"value\":\"false\",\"params\":{\"query\":false,\"type\":\"phrase\"}},\"query\":{\"match\":{\"is_merge\":{\"query\":false,\"type\":\"phrase\"}}},\"$state\":{\"store\":\"appState\"}}]}"}},"type":"dashboard","updated_at":"2019-03-22T13:11:37.292Z"}}

diff --git a/analytics-setup/wait-for-elasticsearch b/analytics-setup/wait-for-elasticsearch
new file mode 100755
index 0000000..fc8f3ca
--- /dev/null
+++ b/analytics-setup/wait-for-elasticsearch
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Copyright (C) 2019 GerritForge Ltd
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+wait_for() {
+  for i in `seq 30` ; do
+	  curl -f ${ELASTICSEARCH_URL}:${ELASTICSEARCH_PORT}/_cluster/health > /dev/null 2>&1
+    result=$?
+    if [ $result -eq 0 ] ; then
+      if [ $# -gt 0 ] ; then
+        exec "$@"
+      fi
+      exit 0
+    fi
+    echo "* Waiting for Elasticsearch ${ELASTICSEARCH_URL}:${ELASTICSEARCH_PORT} ($i/30)"
+    sleep 2
+  done
+  echo "Operation timed out" >&2
+  exit 1
+}
+
+wait_for "$@"
diff --git a/local_environment/README.md b/local_environment/README.md
new file mode 100644
index 0000000..e1c30c0
--- /dev/null
+++ b/local_environment/README.md
@@ -0,0 +1,39 @@
+# Local environment
+
+this project provides a docker-compose to facilitate spinning of a local environment running kibana and elasticsearch.
+
+## Getting Started
+
+To get you running in no time, this project also provides a way to spin up a local environment with elasticsearch and kibana:
+
+```bash
+cd local_environment
+docker-compose up
+```
+
+this will start:
+* elasticsearch, bound and exposing port 9200 and 9300
+* kibana, bound and exposing port 5601
+
+### Build kibana for local environment
+
+The docker-compose relies on an external image (```gerritforge/analytics-kibana-6.5.4``), which is also maintained
+as part of this repository.
+If you don't need to make any changes to it you can just spin up the docker-compose, however if you want to build a
+new version you must follow these steps:
+
+* you must have an instance of elasticsearch running (this is needed by the kibana optimization step),
+if you don't you can use the docker-compose one:
+
+```bash
+cd local_environment
+docker-compose up elasticsearch
+```
+
+* Make the relevant changes to the kibana `Dockerfile`
+
+```bash
+cd local_environment/kibana
+# ... make changes ...
+docker build --network=local_environment_analytics -t gerritforge/analytics-kibana-6.5.4 .
+```
\ No newline at end of file
diff --git a/local_environment/docker-compose.yaml b/local_environment/docker-compose.yaml
new file mode 100644
index 0000000..e589593
--- /dev/null
+++ b/local_environment/docker-compose.yaml
@@ -0,0 +1,31 @@
+version: '3'
+services:
+
+  kibana:
+    image: gerritforge/analytics-kibana-6.5.4
+    container_name: "analytics-kibana-6.5.4"
+    networks:
+      - analytics
+    depends_on:
+      - elasticsearch
+    ports:
+      - "5601:5601"
+
+  elasticsearch:
+    build: elasticsearch
+    container_name: "analytics-elasticsearch-6.5.4"
+    networks:
+      - analytics
+    environment:
+      - ES_JAVA_OPTS=-Xmx1g -Xms1g
+      - http.host=0.0.0.0
+      - network.host=_local_
+      - http.publish_host=_local_
+      - http.cors.allow-origin=*
+      - http.cors.enabled=true
+    ports:
+      - "9200:9200"
+      - "9300:9300"
+networks:
+  analytics:
+    driver: bridge
diff --git a/local_environment/elasticsearch/Dockerfile b/local_environment/elasticsearch/Dockerfile
new file mode 100644
index 0000000..ea8be9e
--- /dev/null
+++ b/local_environment/elasticsearch/Dockerfile
@@ -0,0 +1,8 @@
+FROM docker.elastic.co/elasticsearch/elasticsearch:6.5.4
+
+env XPACK_LICENSE_SELF_GENERATED_TYPE=basic
+env XPACK_ML_ENABLED=false
+env XPACK_MONITORING_ENABLED=false
+env XPACK_SECURITY_ENABLED=false
+env XPACK_SECURITY_AUDIT_ENABLED=false
+env XPACK_WATCHER_ENABLED=false
diff --git a/local_environment/kibana/Dockerfile b/local_environment/kibana/Dockerfile
new file mode 100644
index 0000000..625041c
--- /dev/null
+++ b/local_environment/kibana/Dockerfile
@@ -0,0 +1,11 @@
+FROM docker.elastic.co/kibana/kibana:6.5.4
+
+env XPACK_ML_ENABLED=false
+env XPACK_APM_ENABLED=false
+env XPACK_APM_UI_ENABLED=false
+env XPACK_GRAPH_ENABLED=false
+env XPACK_INFRA_ENABLED=false
+env XPACK_MONITORING_ENABLED=false
+env XPACK_REPORTING_ENABLED=false
+
+RUN /usr/local/bin/kibana-docker --optimize