Install with:
npm install --save @plugandtrade/elasticsearch-bootstrap
Run with:
./node_modules/.bin/elasticsearch-bootstrap --indices ./indices.json
Or, edit your package.json to include it in your scripts, e.g.:
// other stuff
"scripts": {
// other commands
"bootstrap": "elasticsearch-bootstrap --indices ./indices.json"
},
// other stuff
and run it using:
npm run bootstrap -- --host 'http://localhost:9200'
Note: the -- are needed before the options that should be passed to the script
Install with:
npm install -g @plugandtrade/elasticsearch-bootstrap
Run with:
elasticsearch-bootstrap --indices ./indices.json
.. --host <url_to_elasticsearch>
Complete http url, e.g. http://localhost:9200. The default is http://localhost:9200.
... --scripts <path-to-scripts>
The path must be a folder containing one file per script, the name of each file will be used as the id of the stored script.
Example:
- ./scripts/
- my_first_script.hbs
- my_second_script.hbs
Supported script languages:
.hbs... --index-templates <path-to-templates>
The path must be a folder containing json files where each file is an index template. If the template property is not specified in the file, {filename}-* will be used as template pattern.
Example:
- ./index-templates/
- my_first_template.json
- my_second_template.json
... --indices <path-to-index-configurations>
The index configurations file must be a valid json file with the following structure:
{
"indices": [
{
"name": "my_index",
"index": "my_index-{{timestamp}}"
"config": {}
}
]
}
config property is optional and must be a valid index configuration if set.index property defaults to [name]-{{timestamp}}, it must be a string
and will be compiled as a handlebars template with the timestamp variable set
to Date.now().name property must be unique.The above config will create an index named my_index-{unix_timestamp}.
... --move-aliases <path-to-alias-configuration>
The alias configurations file must be a valid json file with the following structure:
{
"indices": [
{
"name": "my_index",
"alias": "my_alias",
"index": "my_index-12345"
}
]
}
alias property defaults to [name].name property must be unique.index property is optional and will be overwritten by the actual index name created using --indices ... with the same name.The above config will the alias my_alias to my_index-12345.
The indices configuration and aliases configuration are compatible and may be merged, e.g.:
{
"indices": [
{
"name": "my_index",
"alias": "my_alias",
"index": "my_index-{{timestamp}}"
}
]
}
Example: Indices json:
{
"name": "my_index"
}
Aliases json:
{
"name": "my_index"
}
will result in the index my_index-123456 and the alias my_index -> my_index-123456.
... --reindex <path-to-reindex-configuration>
The alias configurations file must be a valid json file with the following structure:
{
"indices": [
{
"name": "my_index",
"alias": "my_alias",
"index": "my_index-12345"
}
]
}
alias property defaults to [name].name property must be unique.index property is optional and will be overwritten by the actual index name created using --indices ... with the same name.This option will reindex all document in alias to index using the reindex API.
The indices, aliases and reindex configurations are compatible and may be merged.
... --seeds <path-to-seeds>
The path must be a folder with a seed structure. A seed structure follows this simple rule:
- <index_name>/
- <type_name>/
- <document_id>.json
- <type_name>/
- <document_id>.json
The json files must be valid json containing the data of each document.
If the indices option is specified the index_name will be replaced by the
actual index name created with the name parameter equal to index_name.
Content type
Image
Digest
Size
259.9 MB
Last updated
over 7 years ago
docker pull plugandtrade/elasticsearch-bootstrap