Skip to content

Instantly share code, notes, and snippets.

@pedroagabreu
Last active September 20, 2017 10:57
Show Gist options
  • Save pedroagabreu/b5e982b0b100f4066458 to your computer and use it in GitHub Desktop.
Save pedroagabreu/b5e982b0b100f4066458 to your computer and use it in GitHub Desktop.
Elasticsearch query examples using cURL
# pull 2M records and drop metadata
curl -sN -XPOST 'http://localhost:9200/logstash-2015.11.04/_search' -d '{"sort": ["@timestamp"], "query": {"match": {"who": "me"}}, "from": 0, "size": 1000000}' | jq -c '.hits.hits[]._source' > output.json
curl -sN -XPOST 'http://localhost:9200/logstash-2015.11.04/_search' -d '{"sort": ["@timestamp"], "query": {"match": {"who": "me"}}, "from": 1000001, "size": 1000000}' | jq -c '.hits.hits[]._source' > output2.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment