@betterthings/reset-es-datadeprecated

reset elasticsearch data

Usage no npm install needed!

<script type="module">
  import betterthingsResetEsData from 'https://cdn.skypack.dev/@betterthings/reset-es-data';
</script>

README

Reset Elasticsearch Data

⚠️ Attention: there are no tests and it was created at 2am

A utility to index and reset the data in your local Elasticsearch based on a certain directory structure. It can be used to reset the database during local development / testing.

Important: Elasticsearch needs to listen at localhost:9200.

reset-es-data takes the data directory of the current working directory and does the following:

  • for each data/<index> folder it first deletes and then creates the index <index> with the mapping stored in data/<index>/_mapping.json
  • for each data/<index>/<type>/<id>.json file it indexes the document

Running the tool at the following directory structure will create the index users and add alice and bob to the users/default type.

data
  users
    _mapping.json
    default
      alice.json
      bob.json

Authors