Add ability to configure multiple kibana dashboards

Exploit kibana spaces, which allows to run multiple kibana
dashboards separate from each others.

Please note that this change does not prevent kibana dashboards to have
visibility on elasticsearch indexes beyond the namespace they currently
are configured for.

Authorization will be added in future releases.

Feature: Issue 9865
Change-Id: I02938a0c4ed38d84a47d5cc181443807e66c5e4a
diff --git a/README.md b/README.md
index 60ac488..5e3615e 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
 # Kibana Dashboard
 
-The goal of this project is to provide the tools to manage and configure a kibana dashboard
+The goal of this project is to provide the tools to manage and configure kibana dashboard(s)
 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.
@@ -25,6 +25,12 @@
 * elasticsearch, bound and exposing port 9200 and 9300
 * kibana, bound and exposing port 5601
 
+and will also configure the dashboard for you so that you already have all the mappings, the kibana settigs and the main visualizations and dashboard already configured.
+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)
+
 ### Prerequisites
 
 * [docker](https://www.docker.com/)
@@ -34,21 +40,19 @@
 ## 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]```
+```make restore [ELASTICSEARCH_URL] [ELASTICSEARCH_PORT] [NAMESPACE]```
 
 * ELASTICSEARCH_URL: default is `http://host.docker.internal` (the current host running docker)
 * ELASTICSEARCH_PORT: default is 9200
+* NAMESPACE: default is empty.
 
-For example to configure kibana spinned up via local environment you can simply run:
-```bash
-cd analytics-setup
-make restore
-```
+#### Namespace
+A namespace is a string that will be postifxed to elassticsearch indexes.
+This allows to configure multiple kibana instances against the same elasticsearch instance without collision of names.
+For example, if you use the namespace _foo_, this will configure in order:
 
-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)
+* an elasticsearch index named gitcommitsfoo
+* a kibana dashboard named .kibanafoo
 
 ## Dump kibana configuration
 
diff --git a/analytics-setup/Dockerfile b/analytics-setup/Dockerfile
index 08dad7d..7bff61b 100644
--- a/analytics-setup/Dockerfile
+++ b/analytics-setup/Dockerfile
@@ -1,6 +1,6 @@
 FROM taskrabbit/elasticsearch-dump:v3.3.1
 
-RUN apk add --no-cache curl
+RUN apk add --no-cache curl gettext
 
 COPY docker-entrypoint.sh wait-for-elasticsearch /
 COPY ./elasticsearch-config/ /elasticsearch-config/
diff --git a/analytics-setup/Makefile b/analytics-setup/Makefile
index 369cfe4..1ad4a01 100644
--- a/analytics-setup/Makefile
+++ b/analytics-setup/Makefile
@@ -17,6 +17,7 @@
 
 ELASTICSEARCH_URL=http://host.docker.internal
 ELASTICSEARCH_PORT=9200
+NAMESPACE=""
 
 .PHONY: build restore
 
@@ -26,6 +27,7 @@
 	docker run --rm -it \
 		-e ELASTICSEARCH_URL=$(ELASTICSEARCH_URL) \
 		-e ELASTICSEARCH_PORT=$(ELASTICSEARCH_PORT) \
+		-e NAMESPACE=$(NAMESPACE) \
 		$(RESTORER_IMG)
 dump: build
 	docker run --rm -it \
diff --git a/analytics-setup/docker-entrypoint.sh b/analytics-setup/docker-entrypoint.sh
index 31ed2b3..41b4512 100755
--- a/analytics-setup/docker-entrypoint.sh
+++ b/analytics-setup/docker-entrypoint.sh
@@ -16,30 +16,42 @@
 
 /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
+ES_URL="$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT"
 
-	echo "* * * * Creating $index_name index * * * *"
-	curl -XPUT "$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/$index_name?pretty" -H 'Content-Type: application/json'
+echo "* * * * Create elasticsearch indexes @ $ES_URL * * * *"
+for template_file in `ls -v /elasticsearch-config/*.json`; do
+	echo "--> $template_file";
 
-    curl -XPOST "$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/_aliases" -H 'Content-Type: application/json' -d"{\"actions\" : [
-            { \"add\" : { \"index\" : \"$index_name\", \"alias\" : \"$index_template_name\" } }
+    index_template=$(basename $template_file .json)
+
+	namespaced_index_name=${index_template}${NAMESPACE}
+	namespaced_initial_index_name="${namespaced_index_name}_initial"
+
+	echo "* * * Creating $index_template index template"
+	curl -X PUT -v -H 'Content-Type: application/json' -d @${template_file} ${ES_URL}/_template/${index_template}
+
+	echo "* * * * Creating $namespaced_initial_index_name index * * * *"
+	curl -XPUT "$ES_URL/$namespaced_initial_index_name?pretty" -H 'Content-Type: application/json'
+
+    echo "* * * * Creating alias $namespaced_index_name -> $namespaced_initial_index_name index * * * *"
+    curl -XPOST "$ES_URL/_aliases" -H 'Content-Type: application/json' -d"{\"actions\" : [
+            { \"add\" : { \"index\" : \"$namespaced_initial_index_name\", \"alias\" : \"$namespaced_index_name\" } }
         ]
     }"
 
 done;
 
-echo "* * * * Input kibana settings @ $ELASTICSEARCH_URL:$ELASTICSEARCH_PORT * * * *"
-for file in `ls -v /kibana-config/*.data.json`; do
-       echo "--> $file";
+echo "* * * * Input kibana settings and visualizations @ $ES_URL [.kibana] * * * *"
+for template_file in `ls -v /kibana-config/*.template.json`; do
+       target=$(mktemp /tmp/kibana-config.XXXXXX);
+
+       echo "* * * * compiling $template_file into $target";
+       envsubst < ${template_file} > ${target};
+
         /usr/lib/node_modules/elasticdump/bin/elasticdump \
-            --output=$ELASTICSEARCH_URL:$ELASTICSEARCH_PORT/.kibana \
-            --input=$file \
+            --output=${ES_URL}/.kibana \
+            --input=${target} \
             --type=data \
             --headers '{"Content-Type": "application/json"}';
-done;
+        echo "Done with $template_file";
+done;
\ No newline at end of file
diff --git a/analytics-setup/kibana-config/analytics-settings-dashboards-visualizations.data.json b/analytics-setup/kibana-config/analytics-settings-dashboards-visualizations.data.json
deleted file mode 100644
index 3cd4db3..0000000
--- a/analytics-setup/kibana-config/analytics-settings-dashboards-visualizations.data.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{"_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/kibana-config/kibana-configuration.template.json b/analytics-setup/kibana-config/kibana-configuration.template.json
new file mode 100644
index 0000000..071469d
--- /dev/null
+++ b/analytics-setup/kibana-config/kibana-configuration.template.json
@@ -0,0 +1,13 @@
+{"_index":".kibana_1","_type":"doc","_id":"space:$NAMESPACE","_score":1,"_source":{"space":{"name":"$NAMESPACE","description":"$NAMESPACE analytics"},"type":"space"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:config:6.5.4","_score":1,"_source":{"config":{"buildNum":18878,"defaultIndex":"$NAMESPACE-10"},"type":"config","namespace": "$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:index-pattern:$NAMESPACE-10","_score":1,"_source":{"index-pattern":{"title":"gitcommits$NAMESPACE*","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","namespace":"$NAMESPACE","migrationVersion":{"index-pattern":"6.5.0"}}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:dashboard:$NAMESPACE-11","_score":1,"_source":{"dashboard":{"title":"$NAMESPACE - Git Commits Dashboard","hits":0,"description":"Git Commits Dashboard for $NAMESPACE","panelsJSON":"[{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":6,\"i\":\"1\"},\"id\":\"$NAMESPACE-5\",\"panelIndex\":\"1\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":24,\"w\":35,\"h\":20,\"i\":\"2\"},\"id\":\"$NAMESPACE-8\",\"panelIndex\":\"2\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":24,\"y\":44,\"w\":24,\"h\":18,\"i\":\"4\"},\"id\":\"$NAMESPACE-6\",\"panelIndex\":\"4\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":44,\"w\":24,\"h\":18,\"i\":\"5\"},\"id\":\"$NAMESPACE-7\",\"panelIndex\":\"5\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":24,\"y\":62,\"w\":24,\"h\":20,\"i\":\"6\"},\"id\":\"$NAMESPACE-4\",\"panelIndex\":\"6\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{},\"gridData\":{\"x\":0,\"y\":82,\"w\":48,\"h\":21,\"i\":\"7\"},\"id\":\"$NAMESPACE-1\",\"panelIndex\":\"7\",\"type\":\"visualization\",\"version\":\"6.5.4\"},{\"embeddableConfig\":{\"vis\":{\"legendOpen\":false}},\"gridData\":{\"x\":0,\"y\":6,\"w\":48,\"h\":18,\"i\":\"8\"},\"id\":\"$NAMESPACE-2\",\"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\":\"$NAMESPACE-3\",\"embeddableConfig\":{}},{\"gridData\":{\"x\":35,\"y\":24,\"w\":13,\"h\":20,\"i\":\"10\"},\"version\":\"6.5.4\",\"panelIndex\":\"10\",\"type\":\"visualization\",\"id\":\"$NAMESPACE-9\",\"embeddableConfig\":{\"vis\":{\"legendOpen\":false}}}]","optionsJSON":"{\"darkTheme\":false,\"hidePanelTitles\":false,\"useMargins\":true}","version":1,"timeRestore":false,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[{\"meta\":{\"index\":\"$NAMESPACE-10\",\"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\"}}},\"\":{\"store\":\"appState\"}}]}"}},"type":"dashboard","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-8","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Project Stats","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-9","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - 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\":\"$NAMESPACE - GIT Commits - bot-like commits\",\"type\":\"pie\"}","uiStateJSON":"{}","description":"","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"$NAMESPACE-10\",\"query\":{\"language\":\"lucene\",\"query\":\"\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-7","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Commits per Author","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-6","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Commits per Organization","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-5","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Overall Statistics","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-4","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Organization Stats","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-3","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Authors Stats","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-1","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - Authors activity over the years","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}

+{"_index":".kibana_1","_type":"doc","_id":"$NAMESPACE:visualization:$NAMESPACE-2","_score":1,"_source":{"visualization":{"title":"$NAMESPACE - GIT Commits - commits over time","visState":"{\"title\":\"$NAMESPACE - 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\":\"$NAMESPACE-10\",\"query\":{\"query\":\"\",\"language\":\"lucene\"},\"filter\":[]}"}},"type":"visualization","namespace":"$NAMESPACE"}}
\ No newline at end of file
diff --git a/local_environment/README.md b/local_environment/README.md
index e1c30c0..55e65f7 100644
--- a/local_environment/README.md
+++ b/local_environment/README.md
@@ -15,6 +15,19 @@
 * elasticsearch, bound and exposing port 9200 and 9300
 * kibana, bound and exposing port 5601
 
+and will also configure the dashboard for you so that you already have all the mappings, the kibana settigs and the main
+visualizations and dashboard already configured.
+
+### Multiple dashboards environment
+
+If you want to spin up an environment in which you have multiple kibana dashboards configured,
+you ca run the following:
+
+```bash
+cd local_environmet
+docker-compose -f docker-compose.multi-dashboard.yaml up
+```
+
 ### Build kibana for local environment
 
 The docker-compose relies on an external image (```gerritforge/analytics-kibana-6.5.4``), which is also maintained
diff --git a/local_environment/analytics-setup b/local_environment/analytics-setup
new file mode 120000
index 0000000..5ff66d2
--- /dev/null
+++ b/local_environment/analytics-setup
@@ -0,0 +1 @@
+../analytics-setup
\ No newline at end of file
diff --git a/local_environment/docker-compose.multi-dashboard.yaml b/local_environment/docker-compose.multi-dashboard.yaml
new file mode 100644
index 0000000..8fb3460
--- /dev/null
+++ b/local_environment/docker-compose.multi-dashboard.yaml
@@ -0,0 +1,56 @@
+version: '3'
+services:
+
+  kibana:
+    image: gerritforge/analytics-kibana-6.5.4
+    container_name: "analytics-kibana-multi_a-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"
+
+  setup_dashboard_a:
+    build: analytics-setup
+    container_name: "analytics-setup-dashboard_a-for-6.5.4"
+    depends_on:
+      - elasticsearch
+    networks:
+      - analytics
+    environment:
+      - ELASTICSEARCH_URL=http://elasticsearch
+      - ELASTICSEARCH_PORT=9200
+      - NAMESPACE=dashboard_a
+
+  setup_dashboard_b:
+    build: analytics-setup
+    container_name: "analytics-setup-dashboard_b-for-6.5.4"
+    depends_on:
+      - elasticsearch
+    networks:
+      - analytics
+    environment:
+      - ELASTICSEARCH_URL=http://elasticsearch
+      - ELASTICSEARCH_PORT=9200
+      - NAMESPACE=dashboard_b
+
+networks:
+  analytics:
+    driver: bridge
diff --git a/local_environment/docker-compose.yaml b/local_environment/docker-compose.yaml
index e589593..d40d863 100644
--- a/local_environment/docker-compose.yaml
+++ b/local_environment/docker-compose.yaml
@@ -26,6 +26,19 @@
     ports:
       - "9200:9200"
       - "9300:9300"
+
+  setup:
+    build: analytics-setup
+    container_name: "analytics-setup-for-6.5.4"
+    depends_on:
+      - elasticsearch
+    networks:
+      - analytics
+    environment:
+      - ELASTICSEARCH_URL=http://elasticsearch
+      - ELASTICSEARCH_PORT=9200
+      - NAMESPACE=localenv
+
 networks:
   analytics:
     driver: bridge