kuzzle 2.20.2 → 2.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -420,6 +420,7 @@ const defaultConfig = {
420
420
  onUpdateConflictRetries: 0,
421
421
  scrollTTL: "15s",
422
422
  },
423
+ generateMissingAliases: true,
423
424
  },
424
425
  },
425
426
  stats: {
@@ -175,10 +175,12 @@ class ClientAdapter {
175
175
  /**
176
176
  * Populates the index cache with existing index/collection.
177
177
  * Also checks for duplicated index names.
178
- *
179
- * @returns {Promise}
180
178
  */
181
179
  async populateCache() {
180
+ if (global.kuzzle.config.services.storageEngine.generateMissingAliases) {
181
+ await this.client.generateMissingAliases();
182
+ }
183
+
182
184
  const schema = await this.client.getSchema();
183
185
 
184
186
  for (const [index, collections] of Object.entries(schema)) {
@@ -1894,10 +1894,6 @@ class ElasticSearch extends Service {
1894
1894
  * @returns {Object.<String, String[]>} Object<index, collections>
1895
1895
  */
1896
1896
  async getSchema() {
1897
- // This check avoids a breaking change for those who were using Kuzzle before
1898
- // alias attribution for each indice was the standard ('auto-version')
1899
- await this._ensureAliasConsistency();
1900
-
1901
1897
  let body;
1902
1898
  try {
1903
1899
  ({ body } = await this._client.cat.aliases({ format: "json" }));
@@ -3044,9 +3040,9 @@ class ElasticSearch extends Service {
3044
3040
  * When the latter is missing, create one based on the indice name.
3045
3041
  *
3046
3042
  * This check avoids a breaking change for those who were using Kuzzle before
3047
- * alias attribution for each indice turned into a standard ('auto-version').
3043
+ * alias attribution for each indice turned into a standard (appear in 2.14.0).
3048
3044
  */
3049
- async _ensureAliasConsistency() {
3045
+ async generateMissingAliases() {
3050
3046
  try {
3051
3047
  const { body } = await this._client.cat.indices({ format: "json" });
3052
3048
  const indices = body.map(({ index: indice }) => indice);
@@ -318,9 +318,21 @@ export type StorageEngineElasticsearch = {
318
318
  };
319
319
  };
320
320
  };
321
- maxScrollDuration: "1m";
321
+ maxScrollDuration: string;
322
322
  defaults: {
323
- onUpdateConflictRetries: 0;
324
- scrollTTL: "15s";
323
+ onUpdateConflictRetries: number;
324
+ scrollTTL: string;
325
325
  };
326
+ /**
327
+ * If true, Kuzzle will generate aliases for collections that don't have one.
328
+ *
329
+ * Typically, if an indice named `&platform.devices` does not have an alias
330
+ * named `@&platform.devices` and pointing on the indice then it will be generated
331
+ * even if another alias already exists on the indice.
332
+ *
333
+ * This option should be true only for retro-compatibility with Kuzzle < 2.14.0
334
+ *
335
+ * Also see https://github.com/kuzzleio/kuzzle/pull/2117
336
+ */
337
+ generateMissingAliases: boolean;
326
338
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "kuzzle",
3
3
  "author": "The Kuzzle Team <support@kuzzle.io>",
4
- "version": "2.20.2",
4
+ "version": "2.20.3",
5
5
  "description": "Kuzzle is an open-source solution that handles all the data management through a secured API, with a large choice of protocols.",
6
6
  "bin": "bin/start-kuzzle-server",
7
7
  "scripts": {