summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/es5/create-index-es8
-rw-r--r--src/es5/es-query.json18
-rw-r--r--src/es5/sfive-mapping.json56
-rwxr-xr-xsrc/es5/test-query-es8
4 files changed, 90 insertions, 0 deletions
diff --git a/src/es5/create-index-es b/src/es5/create-index-es
new file mode 100755
index 0000000..b3a10bf
--- /dev/null
+++ b/src/es5/create-index-es
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage $0 <index>"
+ exit 1
+fi
+
+curl -XPOST 'http://stream.elevate.at:9200/'"$1"'?pretty' -d @sfive-mapping.json
diff --git a/src/es5/es-query.json b/src/es5/es-query.json
new file mode 100644
index 0000000..c73d079
--- /dev/null
+++ b/src/es5/es-query.json
@@ -0,0 +1,18 @@
+{
+ "aggregations":
+ {
+ "by_hostname":
+ {
+ "terms": { "script": "doc['source-id'].value" }
+ },
+ "the_total_time":
+ {
+ "sum": { "field": "duration-ms" }
+ },
+ "da_klaient_do":
+ {
+ "sum": { "field": "data.client-count" }
+ }
+ }
+}
+
diff --git a/src/es5/sfive-mapping.json b/src/es5/sfive-mapping.json
new file mode 100644
index 0000000..6ed1772
--- /dev/null
+++ b/src/es5/sfive-mapping.json
@@ -0,0 +1,56 @@
+{
+ "mappings" : {
+ "dataupdate" : {
+ "properties" : {
+ "source-id": { "type": "string" },
+ "SourceHubDataUpdateId" : {
+ "type" : "long"
+ },
+ "SourceHubUuid" : {
+ "type" : "string"
+ },
+ "data" : {
+ "properties" : {
+ "bytes-received" : {
+ "type" : "long"
+ },
+ "bytes-sent" : {
+ "type" : "long"
+ },
+ "client-count" : {
+ "type" : "long"
+ }
+ }
+ },
+ "duration-ms" : {
+ "type" : "long"
+ },
+ "hostname" : {
+ "type" : "string",
+ "copy_to": "source-id"
+ },
+ "start-time" : {
+ "type" : "date",
+ "format" : "dateOptionalTime"
+ },
+ "streamer-id" : {
+ "properties" : {
+ "content-id" : {
+ "type" : "string",
+ "copy_to": "source-id"
+ },
+ "format" : {
+ "type" : "string"
+ },
+ "quality" : {
+ "type" : "string"
+ }
+ }
+ },
+ "version" : {
+ "type" : "long"
+ }
+ }
+ }
+ }
+}
diff --git a/src/es5/test-query-es b/src/es5/test-query-es
new file mode 100755
index 0000000..2782cec
--- /dev/null
+++ b/src/es5/test-query-es
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ -z "$1" ]; then
+ echo "Usage $0 <index>"
+ exit 1
+fi
+
+curl -XGET 'http://stream.elevate.at:9200/'"$1"'/dataupdate/_search?pretty' -d @es-query.json