feat: add support for generated elasticsearch mappings

Fixes #38
This commit is contained in:
Wieland Schöbl
2019-05-29 13:42:41 +02:00
committed by Rainer Killinger
parent 7e04fad28b
commit 8eab6b8531
30 changed files with 303 additions and 867 deletions

View File

@@ -20,6 +20,34 @@ you with everything you need to run this backend.
* Node.js (~10) / NPM
* Docker
## Generating Elasticsearch Mapping
The mappings will be generated automatically on the first start. If there are any errors, the backend will inform you and stop
the execution, however it will do its best to complete the mappings. You can then either resolve these errors in the `core-tools` or the `core`, depending on where it originated.
If you need a quick solution, you can also take the generated output file and manually correct the errors, then rename it to `template_[coreVersion].json`
and restart the backend. This time it will take your file. The filenames and the path will be displayed in the log of the backend.
### Manually Resolving Errors
There are multiple types of errors the backend can run into. Manual error resolving requires you to be familiar with Elasticsearch
mappings.
An error will be represented in the output through an Elasticsearch type written in CAPS. Refer to either the console output
or the `error_report_[coreVersion].txt` for more info. If you feel lucky you can try to replace every error (`"type": "MISSING_PREMAP"`,
`"type": "PARSE_ERROR"`, `"type": "TYPE_CONFLICT"`) with
```json
"dynamic": true,
"properties": {}
```
This should ONLY be used as a temporary workaround.
### Startup Behaviour
*This might be important if you work on the Core*
By default, the backend creates a local copy of the generated mappings in `src/storage/elasticsearch/templates/template_[coreVersion].json`.
On each start, it first checks if this file exists, if it does, it will just use that file and *not* generate a new mapping to cut down the time
it takes to start the backend. When you are working on the Core, you might not want to have this behaviour, you can then either delete
the generated file at each start or run the backend with the environment variable `ES_FORCE_MAPPING_UPDATE=true`. This will cause it to generate the mapping
each time starts regardless of whether there are already files there.
## Start Database (Elasticsearch)
Elasticsearch needs some configuration and plugins to be able to work
with the backend. To save you some work we provide a