Skip to content

Instantly share code, notes, and snippets.

@mikeasick
mikeasick / gist:6244074
Created August 15, 2013 19:40
isInt not changing Swagger type
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'
},
@mikeasick
mikeasick / gist:7964683
Created December 14, 2013 20:42
Can't get ElasticSearch minimum / maximum aggregations (aggs) to respect date formatting
GET /vitals/vital/_search
{
"size": 0,
"query": {
"match_all": {}
},
"aggs": {
"min_time" : {
"min" : {
"field" : "recorded_time",
@mikeasick
mikeasick / gist:7966432
Last active December 31, 2015 09:19
Restify serivce produce huge log when trying to hit local Swagger UI at http://localhost:4001/docs/index.htm
"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:7966462
Created December 14, 2013 23:30
Package JSON for large restify log output
{
"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:7966496
Last active December 31, 2015 09:19
Large Restify Log Output
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}
{"name":"vitals_rt","hostname":"lech","pid":32736,"level":30,"req":{"_readableState":{"highWaterMark":16384,"buffer":[],"length":0,"pipes":null,"pipesCount":0,"flowing":false,"ended":false,"endEmitted":false,"reading":false,"calledRead":false,"sync":true,"needReadable":false,"emittedReadable":false,"readableListening":false,"objectMode":false,"defaultEncoding":"utf8","ranOut":false,"awaitDrain":0,"readingMore":false,"decoder":null,"encoding":null},"readable":true,"domain":{"domain":null,"_events":{},"_maxListeners":10,"members":["[Circular]",{"domain":"[Circular]","_events":{},"_maxListeners":10,"output":[],"outputEncodings":[],"writable":true,"_last":false,"chunkedEncoding":false,"shouldKeepAlive":true,"useChunkedEncodingByDefault":true,"sendDate":true,"_headerSent":false,"_header":"","_hasBody":true,"_trailer":"","finished":false,"_hangupClose":false,"socke
@mikeasick
mikeasick / gist:8734034
Created January 31, 2014 15:20
ES Aggregates: Metrics on Metrics Example Data
{ "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:8734117
Last active August 29, 2015 13:55
ES Aggregates: Metrics on Metrics Example Query
curl -XGET "http://localhost:9200/vitals/vital/_search" -d'
{
"size": 0,
"query": {
"filtered": {
"query": {
"match_all": {}
},
"filter": {
"and": {
@mikeasick
mikeasick / gist:8734325
Created January 31, 2014 15:35
ES Aggregates: Metrics on Metrics Example Results
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" : {
"total" : 975299,
@mikeasick
mikeasick / gist:8734404
Created January 31, 2014 15:38
ES Aggregates: Metrics on Metrics Example Data
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"} }
{ "recorded_time" : "2014-01-31T00:00:02.000-05:00", "user_guid" : "0ad08904-c1cf-46cf-9a04-e0865
@mikeasick
mikeasick / gist:8738689
Created January 31, 2014 17:55
ES Aggregates: Metrics on Metrics Mapping
{
"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"],