@vegan-friendly/strapi-plugin-elasticsearch 0.2.1 → 0.2.2

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.
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  export declare const SubNavigation: ({ activeUrl }: {
3
- activeUrl: any;
3
+ activeUrl?: string | null;
4
4
  }) => React.JSX.Element;
@@ -10,7 +10,7 @@ const design_system_1 = require("@strapi/design-system");
10
10
  const design_system_2 = require("@strapi/design-system");
11
11
  const react_router_dom_1 = require("react-router-dom");
12
12
  const pluginId_1 = __importDefault(require("../../pluginId"));
13
- const SubNavigation = ({ activeUrl }) => {
13
+ const SubNavigation = ({ activeUrl = null }) => {
14
14
  const links = [
15
15
  {
16
16
  id: 1,
@@ -110,7 +110,7 @@ const ConfigureCollection = () => {
110
110
  const updateCollectionsConfig = ({ index, config }) => {
111
111
  setCollectionConfig({
112
112
  collectionName: collectionConfig.collectionName,
113
- attributes: collectionConfig.attributes.map((e, idx) => index === idx ? config : e)
113
+ attributes: collectionConfig.attributes.map((e, idx) => (index === idx ? config : e)),
114
114
  });
115
115
  };
116
116
  const saveCollectionConfig = () => {
@@ -125,12 +125,16 @@ const ConfigureCollection = () => {
125
125
  saveConfigForCollection(collectionConfig.collectionName, data)
126
126
  .then((resp) => {
127
127
  toggleNotification({
128
- type: "success", message: "The collection configuration is saved.", timeout: 5000
128
+ type: 'success',
129
+ message: 'The collection configuration is saved.',
130
+ timeout: 5000,
129
131
  });
130
132
  })
131
133
  .catch((err) => {
132
134
  toggleNotification({
133
- type: "warning", message: err.message || "An error was encountered.", timeout: 5000
135
+ type: 'warning',
136
+ message: err.message || 'An error was encountered.',
137
+ timeout: 5000,
134
138
  });
135
139
  console.log(err);
136
140
  })
@@ -147,7 +151,9 @@ const ConfigureCollection = () => {
147
151
  .then((resp) => {
148
152
  if (Object.keys(resp).length === 0) {
149
153
  toggleNotification({
150
- type: "warning", message: 'No collection with the selected name exists.', timeout: 5000
154
+ type: 'warning',
155
+ message: 'No collection with the selected name exists.',
156
+ timeout: 5000,
151
157
  });
152
158
  }
153
159
  else {
@@ -162,7 +168,9 @@ const ConfigureCollection = () => {
162
168
  })
163
169
  .catch((err) => {
164
170
  toggleNotification({
165
- type: "warning", message: err.message || "An error was encountered.", timeout: 5000
171
+ type: 'warning',
172
+ message: err.message || 'An error was encountered.',
173
+ timeout: 5000,
166
174
  });
167
175
  console.log(err);
168
176
  });
@@ -51,7 +51,8 @@ const design_system_2 = require("@strapi/design-system");
51
51
  const design_system_3 = require("@strapi/design-system");
52
52
  const helper_plugin_1 = require("@strapi/helper-plugin");
53
53
  const loadRecentIndexingRuns = () => {
54
- return axiosInstance_1.default.get(apiUrls_1.apiFetchRecentIndexingRunLog)
54
+ return axiosInstance_1.default
55
+ .get(apiUrls_1.apiFetchRecentIndexingRunLog)
55
56
  .then((resp) => resp.data)
56
57
  .then((data) => {
57
58
  return data;
@@ -71,17 +72,17 @@ const formattedDate = (dateString) => {
71
72
  const parts = dateTimeFormat.formatToParts(date);
72
73
  let formattedDate = '';
73
74
  parts.forEach((part) => {
74
- if (part.type === "weekday")
75
+ if (part.type === 'weekday')
75
76
  formattedDate += `${part.value}, `;
76
- if (part.type === "day")
77
+ if (part.type === 'day')
77
78
  formattedDate += `${part.value}/`;
78
- if (part.type === "month")
79
+ if (part.type === 'month')
79
80
  formattedDate += `${part.value}/`;
80
- if (part.type === "year")
81
+ if (part.type === 'year')
81
82
  formattedDate += `${part.value} `;
82
- if (part.type === "hour")
83
+ if (part.type === 'hour')
83
84
  formattedDate += `${part.value}:`;
84
- if (part.type === "minute")
85
+ if (part.type === 'minute')
85
86
  formattedDate += `${part.value}`;
86
87
  });
87
88
  return formattedDate;
@@ -89,8 +90,7 @@ const formattedDate = (dateString) => {
89
90
  const ViewIndexingRunLog = () => {
90
91
  const [logTable, setLogTable] = (0, react_1.useState)(null);
91
92
  (0, react_1.useEffect)(() => {
92
- loadRecentIndexingRuns()
93
- .then(setLogTable);
93
+ loadRecentIndexingRuns().then(setLogTable);
94
94
  }, []);
95
95
  if (logTable === null)
96
96
  return react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null);
@@ -12,11 +12,9 @@ const instance = axios_1.default.create({
12
12
  baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
13
13
  });
14
14
  instance.interceptors.request.use(async (config) => {
15
- config.headers = {
16
- 'Authorization': `Bearer ${helper_plugin_1.auth.getToken()}`,
17
- 'Accept': 'application/json',
18
- 'Content-Type': 'application/json',
19
- };
15
+ config.headers.set('Authorization', `Bearer ${helper_plugin_1.auth.getToken()}`);
16
+ config.headers.set('Accept', 'application/json');
17
+ config.headers.set('Content-Type', 'application/json');
20
18
  return config;
21
19
  }, error => {
22
20
  Promise.reject(error);
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A Strapi plugin to enable using Elasticsearch with Strapi CMS.",
5
5
  "homepage": "https://github.com/vegan-friendly/strapi-plugin-elasticsearch",
6
6
  "strapi": {
@@ -12,7 +12,7 @@ exports.default = async ({ strapi }) => {
12
12
  await configureIndexingService.initializeStrapiElasticsearch();
13
13
  if (!Object.keys(pluginConfig).includes('indexingCronSchedule'))
14
14
  console.warn('The plugin strapi-plugin-elasticsearch is enabled but the indexingCronSchedule is not configured.');
15
- else if (!Object.keys(pluginConfig).includes('searchConnector'))
15
+ if (!Object.keys(pluginConfig).includes('searchConnector'))
16
16
  console.warn('The plugin strapi-plugin-elasticsearch is enabled but the searchConnector is not configured.');
17
17
  else {
18
18
  const connector = pluginConfig['searchConnector'];
@@ -185,9 +185,9 @@ declare const _default: {
185
185
  collectionName: any;
186
186
  itemId: any;
187
187
  }): string;
188
- getCurrentIndexName(): Promise<string>;
189
- getIncrementedIndexName(): Promise<string>;
190
- storeCurrentIndexName(indexName: any): Promise<void>;
188
+ getCurrentIndexName(indexPrefix?: string): Promise<string>;
189
+ getIncrementedIndexName(indexPrefix?: string): Promise<string>;
190
+ storeCurrentIndexName(indexName: any, indexPrefix?: string): Promise<void>;
191
191
  modifySubfieldsConfigForExtractor(collectionConfig: any): any;
192
192
  extractDataToIndex({ collectionName, data, collectionConfig }: {
193
193
  collectionName: any;
@@ -29,13 +29,14 @@ exports.default = ({ strapi }) => ({
29
29
  throw err;
30
30
  }
31
31
  },
32
- async createIndex(indexName) {
32
+ async createIndex(indexName, mappings) {
33
33
  try {
34
34
  const exists = await client.indices.exists({ index: indexName });
35
35
  if (!exists) {
36
36
  console.log('strapi-plugin-elasticsearch : Search index ', indexName, ' does not exist. Creating index.');
37
37
  await client.indices.create({
38
38
  index: indexName,
39
+ mappings: mappings ?? undefined,
39
40
  });
40
41
  }
41
42
  }
@@ -67,10 +68,10 @@ exports.default = ({ strapi }) => ({
67
68
  }
68
69
  }
69
70
  },
70
- async attachAliasToIndex(indexName) {
71
+ async attachAliasToIndex(indexName, optionalAliasName, mappings) {
71
72
  try {
72
73
  const pluginConfig = await strapi.config.get('plugin.elasticsearch');
73
- const aliasName = pluginConfig.indexAliasName;
74
+ const aliasName = optionalAliasName ? optionalAliasName : pluginConfig.indexAliasName;
74
75
  const aliasExists = await client.indices.existsAlias({ name: aliasName });
75
76
  if (aliasExists) {
76
77
  console.log('strapi-plugin-elasticsearch : Alias with this name already exists, removing it.');
@@ -78,7 +79,7 @@ exports.default = ({ strapi }) => ({
78
79
  }
79
80
  const indexExists = await client.indices.exists({ index: indexName });
80
81
  if (!indexExists)
81
- await this.createIndex(indexName);
82
+ await this.createIndex(indexName, mappings);
82
83
  console.log('strapi-plugin-elasticsearch : Attaching the alias ', aliasName, ' to index : ', indexName);
83
84
  await client.indices.putAlias({ index: indexName, name: aliasName });
84
85
  }
@@ -22,9 +22,9 @@ declare const _default: ({ strapi }: {
22
22
  collectionName: any;
23
23
  itemId: any;
24
24
  }): string;
25
- getCurrentIndexName(): Promise<string>;
26
- getIncrementedIndexName(): Promise<string>;
27
- storeCurrentIndexName(indexName: any): Promise<void>;
25
+ getCurrentIndexName(indexPrefix?: string): Promise<string>;
26
+ getIncrementedIndexName(indexPrefix?: string): Promise<string>;
27
+ storeCurrentIndexName(indexName: any, indexPrefix?: string): Promise<void>;
28
28
  modifySubfieldsConfigForExtractor(collectionConfig: any): any;
29
29
  extractDataToIndex({ collectionName, data, collectionConfig }: {
30
30
  collectionName: any;
@@ -6,6 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  const fp_1 = require("lodash/fp");
8
8
  const transform_content_1 = __importDefault(require("./transform-content"));
9
+ const defaultIndexPrefix = 'strapi-plugin-elasticsearch-index';
9
10
  const getPluginStore = () => {
10
11
  return strapi.store({
11
12
  environment: '',
@@ -14,7 +15,7 @@ const getPluginStore = () => {
14
15
  });
15
16
  };
16
17
  const getModelPopulationAttributes = (model) => {
17
- if (model.uid === "plugin::upload.file") {
18
+ if (model.uid === 'plugin::upload.file') {
18
19
  const { related, ...attributes } = model.attributes;
19
20
  return attributes;
20
21
  }
@@ -192,34 +193,39 @@ exports.default = ({ strapi }) => ({
192
193
  getIndexItemId({ collectionName, itemId }) {
193
194
  return collectionName + '::' + itemId;
194
195
  },
195
- async getCurrentIndexName() {
196
+ async getCurrentIndexName(indexPrefix = defaultIndexPrefix) {
196
197
  const pluginStore = getPluginStore();
197
198
  const settings = (await pluginStore.get({ key: 'configsettings' }));
198
- let indexName = 'strapi-plugin-elasticsearch-index_000001';
199
+ let indexName = indexPrefix + '_000001';
199
200
  if (settings) {
200
201
  const objSettings = JSON.parse(settings);
201
202
  if (Object.keys(objSettings).includes('indexConfig')) {
202
203
  const idxConfig = objSettings['indexConfig'];
203
- indexName = idxConfig['name'];
204
+ if (idxConfig[indexPrefix]) {
205
+ indexName = idxConfig[indexPrefix];
206
+ }
204
207
  }
205
208
  }
206
209
  return indexName;
207
210
  },
208
- async getIncrementedIndexName() {
209
- const currentIndexName = await this.getCurrentIndexName();
210
- const number = parseInt(currentIndexName.split('index_')[1]);
211
- return 'strapi-plugin-elasticsearch-index_' + String(number + 1).padStart(6, '0');
211
+ async getIncrementedIndexName(indexPrefix = defaultIndexPrefix) {
212
+ const currentIndexName = await this.getCurrentIndexName(indexPrefix);
213
+ const number = parseInt(currentIndexName.split(indexPrefix + '_')[1]);
214
+ return indexPrefix + '_' + String(number + 1).padStart(6, '0');
212
215
  },
213
- async storeCurrentIndexName(indexName) {
216
+ async storeCurrentIndexName(indexName, indexPrefix = defaultIndexPrefix) {
214
217
  const pluginStore = getPluginStore();
215
218
  const settings = (await pluginStore.get({ key: 'configsettings' }));
216
219
  if (settings) {
217
220
  const objSettings = JSON.parse(settings);
218
- objSettings['indexConfig'] = { name: indexName };
221
+ objSettings['indexConfig'] = {
222
+ ...objSettings['indexConfig'],
223
+ [indexPrefix]: indexName,
224
+ };
219
225
  await pluginStore.set({ key: 'configsettings', value: JSON.stringify(objSettings) });
220
226
  }
221
227
  else {
222
- const newSettings = JSON.stringify({ indexConfig: { name: indexName } });
228
+ const newSettings = JSON.stringify({ indexConfig: { [indexPrefix]: indexName } });
223
229
  await pluginStore.set({ key: 'configsettings', value: newSettings });
224
230
  }
225
231
  },
@@ -81,9 +81,9 @@ declare const _default: {
81
81
  collectionName: any;
82
82
  itemId: any;
83
83
  }): string;
84
- getCurrentIndexName(): Promise<string>;
85
- getIncrementedIndexName(): Promise<string>;
86
- storeCurrentIndexName(indexName: any): Promise<void>;
84
+ getCurrentIndexName(indexPrefix?: string): Promise<string>;
85
+ getIncrementedIndexName(indexPrefix?: string): Promise<string>;
86
+ storeCurrentIndexName(indexName: any, indexPrefix?: string): Promise<void>;
87
87
  modifySubfieldsConfigForExtractor(collectionConfig: any): any;
88
88
  extractDataToIndex({ collectionName, data, collectionConfig }: {
89
89
  collectionName: any;
@@ -27,44 +27,44 @@ exports.default = ({ strapi }) => {
27
27
  strapi.log.warn(`No data extracted for ${collectionName} with ID ${itemId}`);
28
28
  return null;
29
29
  }
30
- const data = results[0];
31
- const indexData = collection.mapToIndex ? data : data;
32
- const esService = getElasticsearchService();
30
+ const itemData = results[0];
31
+ const esInterface = getElasticsearchService();
33
32
  const helper = getHelperService();
34
33
  const indexItemId = helper.getIndexItemId(collectionName, itemId);
35
- await esService.indexDataToSpecificIndex({ itemId: indexItemId, itemData: indexData }, collection.indexName);
34
+ const indexName = await helper.getCurrentIndexName();
35
+ await esInterface.indexDataToSpecificIndex({ itemId: indexItemId, itemData }, indexName);
36
36
  strapi.log.debug(`Indexed virtual item: ${collectionName}:${itemId}`);
37
- return indexData;
37
+ return itemData;
38
38
  }
39
39
  catch (error) {
40
40
  strapi.log.error(`Error indexing ${collectionName}:${itemId}: ${error?.message}`);
41
41
  throw error;
42
42
  }
43
43
  },
44
- async reindexAll(indexName) {
44
+ async reindexAll() {
45
+ const timestamp = Date.now();
45
46
  const registry = getRegistryService();
46
47
  const collections = registry.getAll();
47
48
  let totalIndexed = 0;
48
49
  for (const collection of collections) {
49
- totalIndexed += await this.reindex(collection.collectionName, indexName);
50
+ totalIndexed += await this.reindex(collection);
50
51
  }
51
- console.log(`strapi-plugin-elasticsearch : Reindexed ${totalIndexed} items across all ${collections.length} virtual collections`);
52
+ strapi.log.info(`strapi-plugin-elasticsearch : Reindexed ${totalIndexed} items across all ${collections.length} virtual collections. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)} `);
52
53
  return totalIndexed;
53
54
  },
54
55
  /**
55
56
  * Reindex all items in a virtual collection
56
57
  */
57
- async reindex(collectionName, indexName) {
58
- const registry = getRegistryService();
59
- const collection = registry.get(collectionName);
60
- if (!collection) {
61
- throw new Error(`Virtual collection not found: ${collectionName}`);
62
- }
63
- const timestamp = Date.now();
58
+ async reindex(collection) {
59
+ const collectionName = collection.collectionName;
60
+ const indexAlias = collection.indexAlias;
61
+ const helper = getHelperService();
62
+ const oldIndexName = await helper.getCurrentIndexName(indexAlias);
63
+ const newIndexName = await helper.getIncrementedIndexName(indexAlias);
64
+ let timestamp = Date.now();
64
65
  try {
65
- const esService = getElasticsearchService();
66
- const helper = getHelperService();
67
- // await esService.createIndex(tempIndexName);
66
+ const esInterface = getElasticsearchService();
67
+ await esInterface.createIndex(newIndexName, collection.mappings);
68
68
  let page = 0;
69
69
  let hasMoreData = true;
70
70
  let totalIndexed = 0;
@@ -75,18 +75,24 @@ exports.default = ({ strapi }) => {
75
75
  break;
76
76
  }
77
77
  const operations = [];
78
- for (const item of pageData) {
79
- const itemId = helper.getIndexItemId({ collectionName, itemId: item.id });
80
- const itemData = collection.mapToIndex ? item : item;
78
+ for (const itemData of pageData) {
79
+ const itemId = helper.getIndexItemId({ collectionName, itemId: itemData.id });
81
80
  operations.push({ itemId, itemData });
82
81
  }
83
82
  if (operations.length > 0) {
84
- await Promise.all(operations.map((op) => esService.indexDataToSpecificIndex(op, indexName)));
83
+ await Promise.all(operations.map((op) => esInterface.indexDataToSpecificIndex(op, newIndexName)));
85
84
  }
86
85
  totalIndexed += pageData.length;
87
86
  page++;
88
87
  }
89
- strapi.log.info(`Reindexed ${totalIndexed} items for virtual collection: ${collectionName}. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)}`);
88
+ strapi.log.info(`Reindexed ${totalIndexed} items for virtual collection: ${collectionName}. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)}. now updating alias.`);
89
+ timestamp = Date.now();
90
+ await esInterface.attachAliasToIndex(newIndexName, indexAlias, collection.mappings);
91
+ strapi.log.info(`Done attachAliasToIndex alias ${indexAlias} to index ${newIndexName}. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)}`);
92
+ timestamp = Date.now();
93
+ await helper.storeCurrentIndexName(newIndexName, indexAlias);
94
+ await esInterface.deleteIndex(oldIndexName);
95
+ strapi.log.info(`Done deleting ${oldIndexName}. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)}`);
90
96
  return totalIndexed;
91
97
  }
92
98
  catch (error) {
@@ -125,8 +131,8 @@ exports.default = ({ strapi }) => {
125
131
  throw new Error(`Virtual collection not found: ${collectionName}`);
126
132
  }
127
133
  try {
128
- const esService = getElasticsearchService();
129
- await esService.removeItemFromIndex({ itemId });
134
+ const esInterface = getElasticsearchService();
135
+ await esInterface.removeItemFromIndex({ itemId });
130
136
  strapi.log.debug(`Deleted indexed item: ${collectionName}:${itemId}`);
131
137
  return true;
132
138
  }
@@ -1,3 +1,4 @@
1
+ import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types';
1
2
  export interface EsInterfaceService {
2
3
  /**
3
4
  * Initializes the search engine connection.
@@ -15,7 +16,7 @@ export interface EsInterfaceService {
15
16
  * @param indexName - The name of the index to create.
16
17
  * @returns A promise that resolves when the index is created.
17
18
  */
18
- createIndex(indexName: string): Promise<void>;
19
+ createIndex(indexName: string, mappings?: MappingTypeMapping): Promise<void>;
19
20
  /**
20
21
  * Deletes an index from the search engine.
21
22
  * @param indexName - The name of the index to delete.
@@ -25,9 +26,10 @@ export interface EsInterfaceService {
25
26
  /**
26
27
  * Attaches an alias to a specific index.
27
28
  * @param indexName - The index to which the alias should be attached.
29
+ * @param aliasName - Alias to attach. If not provided, alias from configuration 'indexAliasName' will be used.
28
30
  * @returns A promise that resolves when the alias is set.
29
31
  */
30
- attachAliasToIndex(indexName: string): Promise<void>;
32
+ attachAliasToIndex(indexName: string, aliasName?: string, mappings?: MappingTypeMapping): Promise<void>;
31
33
  /**
32
34
  * Checks the connection status of the search engine.
33
35
  * @returns A promise that resolves with the connection status.
@@ -1,5 +1,12 @@
1
- export type VirtualCollectionConfig<T extends {}> = {
2
- indexName: string;
1
+ import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types';
2
+ export type VirtualCollectionConfig<T extends StrapiEntity> = {
3
+ /**
4
+ * The alias of the latest index in Elasticsearch.
5
+ * It also serves as a prefix to actual indexes created in Elasticsearch.
6
+ * The actuall index name will be the `${indexNameBase}_${ind}`, e.g `restaurants_000001` and so on.
7
+ * and the alias will be the `indexNameBase`.
8
+ */
9
+ indexAlias: string;
3
10
  collectionName: string;
4
11
  extractData: (page: number, pageSize?: number) => Promise<T[]>;
5
12
  extractById: (ids: number[]) => Promise<T[]>;
@@ -7,7 +14,11 @@ export type VirtualCollectionConfig<T extends {}> = {
7
14
  collection: string;
8
15
  getIdsToReindex: (result: any) => Promise<number[]>;
9
16
  }>;
10
- mapToIndex?: (item: T) => Promise<object>;
17
+ /**
18
+ * Optional schema to be sent to Elasticsearch when creating the index.
19
+ * If you don't include this, ElasticSearch will automatically create a schema for you.
20
+ */
21
+ mappings?: MappingTypeMapping;
11
22
  };
12
23
  export interface VirtualCollectionsRegistryService {
13
24
  /**
@@ -15,7 +26,7 @@ export interface VirtualCollectionsRegistryService {
15
26
  * @param config - The configuration for the virtual collection
16
27
  * @returns The current instance of the registry
17
28
  */
18
- register<T extends {}>(config: VirtualCollectionConfig<T>): this;
29
+ register<T extends StrapiEntity>(config: VirtualCollectionConfig<T>): this;
19
30
  /**
20
31
  * get all registered virtual collections
21
32
  * @returns An array of all registered virtual collections
@@ -24,6 +35,10 @@ export interface VirtualCollectionsRegistryService {
24
35
  get(collectionName: string): VirtualCollectionConfig<any> | null;
25
36
  findTriggersByCollection(collectionUID: string): Array<VirtualCollectionConfig<any>>;
26
37
  }
38
+ export type StrapiEntity = {
39
+ id: number;
40
+ [key: string]: any;
41
+ };
27
42
  export interface VirtualCollectionsIndexerService {
28
43
  /**
29
44
  * Index a single item from a virtual collection.
@@ -33,15 +48,13 @@ export interface VirtualCollectionsIndexerService {
33
48
  indexItem(collectionName: string, itemId: number): Promise<any>;
34
49
  /**
35
50
  * Reindex all items in a virtual collection index.
36
- * @param indexName - The target index name.
37
51
  */
38
- reindexAll(indexName: string): Promise<any>;
52
+ reindexAll(): Promise<any>;
39
53
  /**
40
54
  * Reindex all items in a virtual collection.
41
- * @param collectionName - The name of the virtual collection.
42
- * @param indexName - The target index name.
55
+ * @param collection - The virtual collection config.
43
56
  */
44
- reindex(collectionName: string, indexName: string): Promise<any>;
57
+ reindex<T extends StrapiEntity>(collection: VirtualCollectionConfig<T>): Promise<any>;
45
58
  /**
46
59
  * Handle a trigger event from a collection.
47
60
  * @param event - The trigger event.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A Strapi plugin to enable using Elasticsearch with Strapi CMS.",
5
5
  "homepage": "https://github.com/vegan-friendly/strapi-plugin-elasticsearch",
6
6
  "strapi": {