{"id":23463561,"url":"https://github.com/arielfr/elastic-tool","last_synced_at":"2025-07-08T00:15:03.381Z","repository":{"id":57221313,"uuid":"60036657","full_name":"arielfr/elastic-tool","owner":"arielfr","description":"Elasticsearch Commander Tool","archived":false,"fork":false,"pushed_at":"2017-01-26T15:09:01.000Z","size":21,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T16:01:28.933Z","etag":null,"topics":["command-line","command-line-tool","commander","elasticsearch","node","nodejs","tool"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arielfr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-30T20:18:42.000Z","updated_at":"2018-03-21T09:28:24.000Z","dependencies_parsed_at":"2022-08-29T02:12:50.894Z","dependency_job_id":null,"html_url":"https://github.com/arielfr/elastic-tool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arielfr/elastic-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arielfr%2Felastic-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arielfr%2Felastic-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arielfr%2Felastic-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arielfr%2Felastic-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arielfr","download_url":"https://codeload.github.com/arielfr/elastic-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arielfr%2Felastic-tool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263947060,"owners_count":23534270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-line","command-line-tool","commander","elasticsearch","node","nodejs","tool"],"created_at":"2024-12-24T09:12:50.734Z","updated_at":"2025-07-08T00:15:03.307Z","avatar_url":"https://github.com/arielfr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM Version](https://img.shields.io/npm/v/elastic-tool.svg)](http://npmjs.com/package/elastic-tool)\n[![Downloads](https://img.shields.io/npm/dt/elastic-tool.svg)](http://npmjs.com/package/elastic-tool)\n\n# Elasticsearch Commander Tool\n\nThis is a Elasticsearch tool made with [commander](https://www.npmjs.com/package/commander) for making basic operations\n\n- Get Template/s\n- Get Index/es\n- Creating Index (One File or Multiple Files)\n- Open Index\n- Close Index\n- Creating Types - Mappings (One File or Multiple Files)\n- Auto detect changes on Type / Mapping file structure\n- Creating Templates (One File or Multiple Files)\n- Delete Index\n- Delete Template\n- Delete Type by ID\n- Get Repository/ies\n- Create Repository\n- Delete Repository\n- Get Snapshot/s\n- Create Snapshot\n- Delete Snapshot\n\n## Installation\n\nYou need to install this package globally\n\n```\nnpm install -g elastic-tool\n```\n\n## Basic Information\n\nFor all the commands that recieves *\u003cfile/folder\u003e* you can pass eathier a file or a folder. If you pass a file, you only going to apply the changes for that file only. If you pass a directory, the application is going to apply the changes for all the files on that directory\n\n```\nelastic put-index /test/directory/file.json\n```\n\nor\n\n```\nelastic put-index /test/directory\n```\n\nThe */* at the end is not mandatory\n\n## Indexes File Format\n\n```json\n{\n  \"index\": \"example\",\n  \"body\": {\n    \"index\": {\n      \"analysis\": {\n        \"analyzer\": {\n          \"sortable\": {\n            \"type\": \"custom\",\n            \"tokenizer\": \"keyword\",\n            \"filter\": [\"lowercase\"]\n          },\n          \"path_hierarchy\": {\n            \"type\": \"custom\",\n            \"tokenizer\": \"path_hierarchy\",\n            \"filter\": [\"lowercase\"]\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThe body content is the body from the Official API of Elasticsearch\n\n## Mapping File Format\n### put-mappings\n\nThis command will always create the mapping\n\n```json\n{\n\t\"index\": \"example\",\n\t\"type\": \"users\",\n\t\"body\": {\n\t\t\"users\": {\n\t\t\t\"properties\": {\n\t\t\t\t\"firstname\": { \"type\": \"string\" },\n\t\t\t\t\"lastname\": { \"type\": \"string\" }\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nThe body content is the body from the Official API of Elasticsearch\n\n### auto-mappings\n\nThis command will automatically detect the changes and *putMapping* of the properties that are not currently on the ES Type\n\n```json\n{\n\t\"index\": \"example\",\n\t\"type\": \"users\",\n\t\"body\": {\n\t\t\"users\": {\n\t\t\t\"properties\": {\n\t\t\t\t\"firstname\": { \"type\": \"string\" },\n\t\t\t\t\"lastname\": { \"type\": \"string\" },\n\t\t\t\t\"phone\": { \"type\": \"string\" }\n\t\t\t}\n\t\t}\n\t}\n}\n```\n\nThis will *putMapping* only the *phone* property\n\nThe body content is the body from the Official API of Elasticsearch\n\n## Templates File Format\n\n```json\n{\n  \"template\": \"template-*\",\n  \"order\": 0,\n  \"body\": {\n    \"settings\" : {\n      \"index\" : {\n        \"number_of_shards\" : 5,\n        \"number_of_replicas\": 0\n      }\n    },\n    \"mappings\": {\n      \"search\": {\n        \"_all\" : { \"enabled\" : false },\n        \"_timestamp\": {\n          \"enabled\": true,\n          \"path\": \"@timestamp\",\n          \"store\": true\n        },\n        \"dynamic\": false,\n        \"properties\": {\n          \"@timestamp\": { \"type\": \"date\"},\n          \"site\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n          \"request\": {\n            \"type\": \"object\",\n            \"dynamic\": false,\n            \"properties\": {\n              \"request_id\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n              \"session_id\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n              \"user_agent\": {\"type\": \"object\", \"dynamic\": false },\n              \"url\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n              \"utm_source\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n              \"utm_medium\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n              \"query\": {\"type\": \"object\", \"dynamic\": false },\n              \"referer\": {\n                \"type\": \"object\",\n                \"dynamic\": false,\n                \"properties\": {\n                  \"url\": { \"type\": \"string\", \"index\": \"not_analyzed\"},\n                  \"intra_site\": { \"type\":\"boolean\" }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n## Insert data\n\nThis command will insert data into de database\n\n```json\n{\n  \"index\": \"example\",\n  \"type\": \"users\",\n  \"records\": [\n    {\n      \"firstname\": \"Ariel\",\n      \"lastname\": \"Rey\"\n    },\n    {\n      \"id\": \"Juan\",\n      \"title\": \"Perez\"\n    }\n  ]\n}\n```\n\nYou can also reference *_parent* property\n\n```json\n{\n  \"index\": \"example\",\n  \"type\": \"users\",\n  \"records\": [\n    {\n      \"_parent\": 1,\n      \"firstname\": \"Ariel\",\n      \"lastname\": \"Rey\"\n    },\n    {\n      \"_parent\": 2,\n      \"id\": \"Juan\",\n      \"title\": \"Perez\"\n    }\n  ]\n}\n```\n\nIn records, you will put the body content is the body from the Official API of Elasticsearch\n\n## Create repository\n\nThe command will create a repository. Example:\n\n```json\n{\n\t\"repository\": \"repo_name\",\n\t\"body\": {\n\t\t\"type\": \"fs\",\n\t\t\"settings\": {\n\t\t\t\"compress\": \"true\",\n\t\t\t\"location\": \"/env/snapshots\"\n\t\t}\n\t}\n}\n```\n\n## Example\n\nYou will find some examples on the example folder for each case\n\n## License\n```\nThe MIT License (MIT)\n\nCopyright (c) \u003c2015\u003e \u003cAriel Rey\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farielfr%2Felastic-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farielfr%2Felastic-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farielfr%2Felastic-tool/lists"}