Created
June 3, 2014 07:34
-
-
Save oroce/f42ac5d08086aa2e2d29 to your computer and use it in GitHub Desktop.
elastic-search.template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"template": "logstash-*", | |
"settings" : { | |
"index" : { | |
"store" : { "compress" : { "stored" : true, "tv": true } } | |
} | |
}, | |
"mappings": { | |
"_default_": { | |
"_all": { "enabled": false }, | |
"_source": { "compress": true }, | |
"dynamic_templates": [ | |
{ | |
"string_template" : { | |
"match" : "*", | |
"mapping": { "type": "string", "index": "not_analyzed" }, | |
"match_mapping_type" : "string" | |
} | |
} | |
], | |
"properties" : { | |
"@fields": { "type": "object", "dynamic": true, "path": "full" }, | |
"@message" : { "type" : "string", "index" : "analyzed" }, | |
"@source" : { "type" : "string", "index" : "not_analyzed" }, | |
"@source_host" : { "type" : "string", "index" : "not_analyzed" }, | |
"@source_path" : { "type" : "string", "index" : "not_analyzed" }, | |
"tags": { "type": "string", "index" : "not_analyzed" }, | |
"@timestamp" : { "type" : "date", "index" : "not_analyzed" }, | |
"type" : { "type" : "string", "index" : "not_analyzed" }, | |
"request_time": { "type": "float" }, | |
"upstream_response_time": { "type": "float" }, | |
"bytes": { "type": "long" }, | |
"geoip":{ | |
"properties":{ | |
"area_code":{"type":"long"}, | |
"city_name":{"type":"string", "index":"not_analyzed"}, | |
"continent_code":{"type":"string"}, | |
"coordinates":{"type":"string"}, | |
"country_code2":{"type":"string"}, | |
"country_code3":{"type":"string"}, | |
"country_name":{"type":"string", "index":"not_analyzed"}, | |
"dma_code":{"type":"long"}, | |
"ip":{"type":"string"}, | |
"latitude":{"type":"double"}, | |
"longitude":{"type":"double"}, | |
"postal_code":{"type":"string"}, | |
"real_region_name":{"type":"string", "index":"not_analyzed"}, | |
"region_name":{"type":"string", "index":"not_analyzed"}, | |
"timezone":{"type":"string"} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g elasticdump |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elasticdump --input=http://localhost:9200/logstash-`date +'%Y.%m.%d'` --output=dump_`date +'%Y.%m.%d'`.json | |
curl -XPUT 'http://localhost:9200/_template/template_logstash/' -d @elasticsearch-template.json | |
curl -XDELETE localhost:9200/logstash-`date +'%Y.%m.%d'` | |
elasticdump --output=http://localhost:9200/logstash-`date +'%Y.%m.%d'` --bulk=true --input=dump_`date +'%Y.%m.%d'`.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment