Skip to content

Instantly share code, notes, and snippets.

@debraj-manna
Forked from stonith/curl
Last active August 29, 2015 14:27
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 debraj-manna/0b039ed3c108554b9171 to your computer and use it in GitHub Desktop.
Save debraj-manna/0b039ed3c108554b9171 to your computer and use it in GitHub Desktop.
logstash elasticsearch template - disable _all field, enable simple analyzer, set default query field to @message
curl -XPUT localhost:9200/_template/logstash -d '
{
"template" : "logs-*",
"settings" : {
"index.analysis.analyzer.default.type": "simple",
"index.cache.field.type": "soft",
"index.compress.stored": true,
"index.merge.policy.max_merged_segment": "5g",
"index.query.default_field": "@message",
"index.refresh_interval": "5s",
"index.term_index_divisor": 1,
"index.term_index_interval": 128,
"number_of_replicas": 1,
"number_of_shards": 3
},
"mappings": {
"_default_": {
"_all": {
"enabled": false
},
"properties": {
"@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"
}
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment