From 18cb07b95f9a5999025efe2e6b3fcdd97591e131 Mon Sep 17 00:00:00 2001 From: Vlad Holubiev Date: Sat, 7 Sep 2019 19:39:38 +0300 Subject: [PATCH] docs: add install / usage example to readme --- README.md | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 266daa7..3966773 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,37 @@ -# elasticsearch-local -Run any version of ElasticSearch locally +# elasticsearch-local [![CircleCI](https://circleci.com/gh/shelfio/elasticsearch-local/tree/master.svg?style=svg)](https://circleci.com/gh/shelfio/elasticsearch-local/tree/master) ![](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![npm (scoped)](https://img.shields.io/npm/v/@shelf/elasticsearch-local.svg)](https://www.npmjs.com/package/@shelf/elasticsearch-local) + +> Run any version of ElasticSearch locally + +## Usage + +### 0. Install + +``` +$ yarn add @shelf/elasticsearch-local --dev +``` + +### 1. Start Elasticsearch + +```js +import {start} from '@shelf/elasticsearch-local'; + +await start({ + esVersion: '7.3.0', + port: 9000, // optional + clusterName: 'test', // optional + nodeName: 'test', // optional + indexes: ['one', 'two'] // optional +}); +``` + +### 2. Stop Elasticsearch + +```js +import {stop} from '@shelf/elasticsearch-local'; + +await stop(); +``` + +## License + +MIT © [Shelf](https://shelf.io)