Skip to content

Instantly share code, notes, and snippets.

@mikeasick
Created January 31, 2014 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikeasick/8738689 to your computer and use it in GitHub Desktop.
Save mikeasick/8738689 to your computer and use it in GitHub Desktop.
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"],
"analysis": {
"filter": {
"nf_edge_flt": {
"max_gram": 20,
"min_gram": 1,
"type": "edge_ngram"
}
},
"analyzer": {
"nf_edge_anl": {
"filter": [
"lowercase",
"nf_edge_flt"
],
"tokenizer": "standard"
}
}
}
},
"mappings": {
"vital": {
"_source": {
"enabled": true
},
"properties": {
"_id": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"recorded_time": {
"type": "date",
"format": "date_time",
"store": "yes",
"index": "not_analyzed",
"include_in_all": false
},
"user_guid": {
"type": "string",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"device_guid": {
"type": "string",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"strokeVolume": {
"type": "double",
"index": "not_analyzed",
"store": "yes",
"include_in_all": true
},
"heartRate": {
"type": "double",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"sp02": {
"type": "double",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"respiratoryRate": {
"type": "double",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"ptt": {
"type": "double",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"diastolic": {
"type": "integer",
"index": "not_analyzed",
"store": "yes",
"include_in_all": true
},
"systolic": {
"type": "integer",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"hrv": {
"type": "double",
"store": "yes",
"include_in_all": false,
"validate": true
},
"steps": {
"type": "integer",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"calories": {
"type": "integer",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
},
"source": {
"type": "string",
"index": "not_analyzed",
"store": "yes",
"include_in_all": false
}
}
}
},
"warmers" : {
"warm_vitals_all" : {
"types" : ["vital"],
"source" : {
"query" : {
"match_all" : {}
}
}
},
"warm_vitals_facets" : {
"types" : ["vital"],
"source" : {
"query": {
"filtered": {
"query": {
"match_all": {}
}
}
},
"aggs": {
"per_5_min": {
"date_histogram": {
"field": "recorded_time",
"interval": "5m",
"format": "date_time"
},
"aggs": {
"strokeVolume_stats": {
"extended_stats": {
"field": "strokeVolume"
}
},
"heartRate_stats": {
"extended_stats": {
"field": "heartRate"
}
},
"sp02_stats": {
"extended_stats": {
"field": "sp02"
}
},
"respiratoryRate_stats": {
"extended_stats": {
"field": "respiratoryRate"
}
},
"ptt_stats": {
"extended_stats": {
"field": "ptt"
}
},
"diastolic_stats": {
"extended_stats": {
"field": "diastolic"
}
},
"steps_stats": {
"extended_stats": {
"field": "steps"
}
},
"calories_stats": {
"extended_stats": {
"field": "calories"
}
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment