loopback-connector-elastic-search
loopback-connector-elastic-search copied to clipboard
Optimize index and mapping creation
We must make sure that the following optimization is possible for most if not all versions of ES.
/*
* 1. create a data structure from `self.settings.mappings`
* that has all mappings grouped under a unique index name
* {
* shakespeare : {
* index: "shakespeare",
* body: {
* mappings: {
* modelNameOrExplicitTypeName_A: {
* properties: {...}
* },
* modelNameOrExplicitTypeName_B: {
* properties: {...}
* }
* }
* }
* },
* juju : {
* index: "juju",
* body: {
* mappings: {
* modelNameOrExplicitTypeName_C: {
* properties: {...}
* },
* modelNameOrExplicitTypeName_D: {
* properties: {...}
* }
* }
* }
* }
* }
*
* 2. Then for each entry, optimize mapping and indexing to happen in one atomic request to ES
*/
References:
- ES 0.90
- ES v1.x
- ES v2.x
- GitHub code search indices.create mappings extension:js
- https://github.com/MennaDarwish/DSP/blob/e6156f3ea41294daeefc73b9a00fb92d232213ba/lib/elasticsearch/indices_initializer.js#L11