Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save robertomiranda/2cc28ed84f6a18afd2c9 to your computer and use it in GitHub Desktop.

Select an option

Save robertomiranda/2cc28ed84f6a18afd2c9 to your computer and use it in GitHub Desktop.
# Fetch all the "mapping" from elasticsearch using the enpoint
# "/_mapping" and saved them on mapping.json file
# curl http://localhost:9200/_mapping
# parse the results fetched and saved into mapping.json and we iterate over
# the parent index names and start to call the endpoint for delete them
require "json"
keys = JSON.parse(`curl http://localhost:9200/_mapping`).keys
keys.each {|key| `curl -XDELETE http://localhost:9200/#{key}`}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment