From c50dd2ca3340fcc86666e411a581b0e3ea3af8bd Mon Sep 17 00:00:00 2001 From: Arsen Ghazaryan Date: Mon, 30 Apr 2018 15:49:43 -0700 Subject: [PATCH] update readme --- README.md | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eabffbe..7d8a3f1 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,46 @@ # elastic-tools -CLI Utilities to export/import JSON from elasticsearch +CLI Utilities to export/import JSON from elasticsearch ## Usage + ### Exporting data to json + ```bash elastic-export --host 127.0.0.1:9200 --index MyIndex --out ./data.json ``` +The \_id of the document from elastic's index will be part of the body of the exported document: + +For example, this document from elastic: + +```json +{ + "_index": "users", + "_type": "_doc", + "_id": "1", + "_score": 1, + "_source": { + "active": true, + "name": "User 1", + "email": "email1" + } +} +``` +will be exported to JSON like this: + +```json +{ + "_id": "1", + "active": true, + "name": "User 1", + "email": "email1" +} +``` + + ### Importing data from json array + ```bash elastic-import --host 127.0.0.1:9200 --index MyIndex --data ./data.json -``` \ No newline at end of file +```