Skip to content

Instantly share code, notes, and snippets.

@kbarber
Created December 12, 2011 15:48
Show Gist options
  • Save kbarber/1467956 to your computer and use it in GitHub Desktop.
Save kbarber/1467956 to your computer and use it in GitHub Desktop.
elasticsearch queries
Searching for apache-access logs:
curl -XGET 'http://localhost:9200/logstash-2011.12.09/_search?q=response:200&pretty=true' | less
Turning on compression:
curl -XPUT localhost:9200/_settings -d '{
"_source" : {"compress" : true}
}'
curl -XPUT localhost:9200/_settings -d '{
"logstash-2011.12.12" : {
"_source" : {"compress" : true}
}
}'
Setting a template:
curl -XPUT localhost:9200/_template/logstash_1 -d '
{
"template" : "logstash*",
"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"syslog" : {
"_source" : { "enabled" : false }
}
}
}'
curl -XPUT localhost:9200/_template/logstash_1 -d '
{
"template" : "logstash*",
"settings" : {
"number_of_shards" : 5
},
"mappings" : {
"*" : {
"_source" : { "compress" : true }
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment