Skip to content

Instantly share code, notes, and snippets.

@iamhowardtheduck
Created August 28, 2020 01:42
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 iamhowardtheduck/7f1accc0f508c67cc1e77694e6e4b4da to your computer and use it in GitHub Desktop.
Save iamhowardtheduck/7f1accc0f508c67cc1e77694e6e4b4da to your computer and use it in GitHub Desktop.
Index template for Port Authority of Pittsburgh API feed.
PUT _index_template/pat-status
{
"version": 1,
"template": {
"settings": {
"index": {
"lifecycle": {
"name": "PAT-Status",
"rollover_alias": "pat-status"
},
"number_of_shards": "1",
"number_of_replicas": "2"
}
},
"mappings": {
"_source": {
"excludes": [],
"includes": [],
"enabled": true
},
"_routing": {
"required": false
},
"dynamic": true,
"numeric_detection": false,
"date_detection": true,
"dynamic_date_formats": [
"strict_date_optional_time",
"yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"
],
"properties": {
"bustime-response.error": {
"type": "object",
"properties": {
"msg": {
"type": "keyword"
},
"rt": {
"type": "keyword"
}
}
},
"bustime-response.vehicle.des": {
"type": "keyword"
},
"bustime-response.vehicle.dly": {
"type": "boolean"
},
"bustime-response.vehicle.geo_location": {
"type": "geo_point"
},
"bustime-response.vehicle.hdg": {
"coerce": true,
"index": true,
"ignore_malformed": false,
"store": false,
"type": "integer",
"doc_values": true
},
"bustime-response.vehicle.lat": {
"type": "half_float"
},
"bustime-response.vehicle.lon": {
"type": "half_float"
},
"bustime-response.vehicle.mode": {
"type": "integer"
},
"bustime-response.vehicle.pdist": {
"type": "integer"
},
"bustime-response.vehicle.pid": {
"type": "integer"
},
"bustime-response.vehicle.psgld": {
"type": "keyword"
},
"bustime-response.vehicle.rt": {
"type": "keyword"
},
"bustime-response.vehicle.rtpidatafeed": {
"type": "keyword"
},
"bustime-response.vehicle.spd": {
"type": "integer"
},
"bustime-response.vehicle.tablockid": {
"type": "keyword"
},
"bustime-response.vehicle.tatripid": {
"type": "integer"
},
"bustime-response.vehicle.tmstmp": {
"format": "yyyyMMdd HH:mm||yyyyMMdd H:m||yyyyMMdd HH:mm||yyyyMd H:m",
"index": true,
"ignore_malformed": false,
"store": false,
"type": "date",
"doc_values": true
},
"bustime-response.vehicle.vid": {
"type": "keyword"
},
"bustime-response.vehicle.zone": {
"type": "keyword"
}
}
}
},
"index_patterns": [
"pat-status*"
],
"composed_of": [
"logs-settings",
"logs-mappings",
"metrics-settings",
"metrics-mappings"
]
}
@iamhowardtheduck
Copy link
Author

PUT pat-status-000001
{
"aliases": {
"pat-status":{
"is_write_index": true
}
}
}

@iamhowardtheduck
Copy link
Author

PUT _ilm/policy/PAT-Status
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "7d",
"max_size": "50gb"
},
"set_priority": {
"priority": 10
}
}
},
"warm": {
"actions": {
"allocate": {
"number_of_replicas": 1,
"include": {},
"exclude": {}
},
"set_priority": {
"priority": 50
}
}
},
"cold": {
"min_age": "14d",
"actions": {
"allocate": {
"number_of_replicas": 1,
"include": {},
"exclude": {}
},
"set_priority": {
"priority": 0
}
}
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment