Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Sick mikeasick

View GitHub Profile
@mikeasick
mikeasick / gist:8738689
Created Jan 31, 2014
ES Aggregates: Metrics on Metrics Mapping
View gist:8738689
{
"template": "vitals_*",
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"term_index_interval": 128,
"refresh_interval": "5s",
"mapper.dynamic": false,
"compress": true,
"index.aliases": ["vitals"],
@mikeasick
mikeasick / gist:8734404
Created Jan 31, 2014
ES Aggregates: Metrics on Metrics Example Data
View gist:8734404
This file has been truncated, but you can view the full file.
{ "index" : {"_index" : "vitals_2014.01.31_idx", "_type" : "vital"} }
{ "recorded_time" : "2014-01-31T00:00:00.000-05:00", "user_guid" : "0ad08904-c1cf-46cf-9a04-e0865c1cced2", "device_guid" : "136bd969-c838-453f-ac58-63ec3419475b", "strokeVolume" : 85.9, "heartRate" : 15.9, "sp02" : 5.7, "respiratoryRate" : 70.6, "ptt": 37.1, "diastolic":53.8, "systolic":6.2, "hrv" : 73.4, "steps" : 65, "calories" : 20, "source" : "foo"}
{ "index" : {"_index" : "vitals_2014.01.31_idx", "_type" : "vital"} }
{ "recorded_time" : "2014-01-31T00:00:01.000-05:00", "user_guid" : "0ad08904-c1cf-46cf-9a04-e0865c1cced2", "device_guid" : "136bd969-c838-453f-ac58-63ec3419475b", "strokeVolume" : 23.8, "heartRate" : 89.4, "sp02" : 87.4, "respiratoryRate" : 58.2, "ptt": 97.9, "diastolic":95.7, "systolic":75.2, "hrv" : 45.1, "steps" : 93, "calories" : 21, "source" : "foo"}
{ "index" : {"_index" : "vitals_2014.01.31_idx", "_type" : "vital"} }
@mikeasick
mikeasick / gist:8734325
Created Jan 31, 2014
ES Aggregates: Metrics on Metrics Example Results
View gist:8734325
This file has been truncated, but you can view the full file.
{
"took" : 156,
"timed_out" : false,
"_shards" : {
"total" : 30,
"successful" : 30,
"failed" : 0
},
"hits" : {
@mikeasick
mikeasick / gist:8734117
Last active Aug 29, 2015
ES Aggregates: Metrics on Metrics Example Query
View gist:8734117
curl -XGET "http://localhost:9200/vitals/vital/_search" -d'
{
"size": 0,
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": {
@mikeasick
mikeasick / gist:8734034
Created Jan 31, 2014
ES Aggregates: Metrics on Metrics Example Data
View gist:8734034
{ "index" : {"_index" : "vitals_2014.01.31_idx", "_type" : "vital"} }
{ "recorded_time" : "2014-01-31T01:00:00.000-05:00", "user_guid" : "0ad08904-c1cf-46cf-9a04-e0865c1cced2", "device_guid" : "136bd969-c838-453f-ac58-63ec3419475b", "strokeVolume" : 43.1, "heartRate" : 50.9, "sp02" : 95.5, "respiratoryRate" : 57.9, "ptt": 84.6, "diastolic":1.1, "systolic":79.9, "hrv" : 62.3, "steps" : 18, "calories" : 16, "source" : "foo"}
{ "index" : {"_index" : "vitals_2014.01.31_idx", "_type" : "vital"} }
{ "recorded_time" : "2014-01-31T01:00:01.000-05:00", "user_guid" : "0ad08904-c1cf-46cf-9a04-e0865c1cced2", "device_guid" : "136bd969-c838-453f-ac58-63ec3419475b", "strokeVolume" : 38.7, "heartRate" : 6.0, "sp02" : 55.8, "respiratoryRate" : 51.6, "ptt": 0.2, "diastolic":22.4, "systolic":9.1, "hrv" : 31.7, "steps" : 95, "calories" : 5, "source" : "foo"}
{ "index" : {"_index" : "vitals_2014.01.31_idx", "_type" : "vital"} }
{ "recorded_time" : "2014-01-31T01:00:02.000-05:00", "user_guid" : "0ad08904-c1cf-46cf-9a04-e0865c1c
@mikeasick
mikeasick / gist:7966496
Last active Dec 31, 2015
Large Restify Log Output
View gist:7966496
This file has been truncated, but you can view the full file.
{"name":"vitals_rt","hostname":"lech","pid":32736,"level":30,"msg":"vitals_rt listening at http://0.0.0.0:4001","time":"2013-12-14T23:32:05.618Z","v":0}
@mikeasick
mikeasick / gist:7966462
Created Dec 14, 2013
Package JSON for large restify log output
View gist:7966462
{
"name": "services",
"preferGlobal": false,
"version": "0.0.1",
"description": "example services for serving vitals data from ElasticSearch ",
"main": "app.js",
"scripts": {
},
"keywords": [
"vitals",
@mikeasick
mikeasick / gist:7966432
Last active Dec 31, 2015
Restify serivce produce huge log when trying to hit local Swagger UI at http://localhost:4001/docs/index.htm
View gist:7966432
"use strict";
var restify = require('restify');
var bunyan = require('bunyan');
var restifySwagger = require('node-restify-swagger');
var restifyValidation = require('node-restify-validation');
var pathSep = "/";
var processName = 'vitals_rt';
var log = createLogger(processName);
var valid_increment_units = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute',
'm','s','h','w','M'
@mikeasick
mikeasick / gist:7964683
Created Dec 14, 2013
Can't get ElasticSearch minimum / maximum aggregations (aggs) to respect date formatting
View gist:7964683
GET /vitals/vital/_search
{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"min_time" : {
"min" : {
"field" : "recorded_time",
@mikeasick
mikeasick / gist:6244074
Created Aug 15, 2013
isInt not changing Swagger type
View gist:6244074
I have a service that is defined below but when I get the swaggar UI, the type is always 'string'. Should isInt=true change the type?
server.get(
{
url: pathSep + feedNoun,
swagger: {
summary: 'search by parameter for feeds',
notes: 'Status=Unstable',
nickname: 'get'
},
You can’t perform that action at this time.