@vegan-friendly/strapi-plugin-elasticsearch 0.2.2 → 0.2.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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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": {
@@ -163,38 +163,7 @@ declare const _default: {
163
163
  };
164
164
  helper: ({ strapi }: {
165
165
  strapi: any;
166
- }) => {
167
- getElasticsearchInfo(): Promise<{
168
- indexingCronSchedule: any;
169
- elasticHost: any;
170
- elasticUserName: any;
171
- elasticCertificate: any;
172
- elasticIndexAlias: any;
173
- connected: any;
174
- initialized: any;
175
- }>;
176
- isCollectionDraftPublish({ collectionName }: {
177
- collectionName: any;
178
- }): boolean;
179
- getPopulateAttribute({ collectionName }: {
180
- collectionName: any;
181
- }): true | {
182
- populate: never;
183
- } | undefined;
184
- getIndexItemId({ collectionName, itemId }: {
185
- collectionName: any;
186
- itemId: any;
187
- }): string;
188
- getCurrentIndexName(indexPrefix?: string): Promise<string>;
189
- getIncrementedIndexName(indexPrefix?: string): Promise<string>;
190
- storeCurrentIndexName(indexName: any, indexPrefix?: string): Promise<void>;
191
- modifySubfieldsConfigForExtractor(collectionConfig: any): any;
192
- extractDataToIndex({ collectionName, data, collectionConfig }: {
193
- collectionName: any;
194
- data: any;
195
- collectionConfig: any;
196
- }): {};
197
- };
166
+ }) => import("./types/helper-service.type").HelperService;
198
167
  transformContent: {
199
168
  transform({ content, from }: {
200
169
  content: any;
@@ -158,4 +158,11 @@ exports.default = ({ strapi }) => ({
158
158
  throw err;
159
159
  }
160
160
  },
161
+ async listIndicesByPattern(pattern = 'restaurants*') {
162
+ const results = await client.cat.indices({
163
+ index: pattern,
164
+ format: 'json',
165
+ });
166
+ return results.map((index) => index.index).filter((index) => index != null);
167
+ },
161
168
  });
@@ -1,35 +1,5 @@
1
+ import { HelperService } from '../types/helper-service.type';
1
2
  declare const _default: ({ strapi }: {
2
3
  strapi: any;
3
- }) => {
4
- getElasticsearchInfo(): Promise<{
5
- indexingCronSchedule: any;
6
- elasticHost: any;
7
- elasticUserName: any;
8
- elasticCertificate: any;
9
- elasticIndexAlias: any;
10
- connected: any;
11
- initialized: any;
12
- }>;
13
- isCollectionDraftPublish({ collectionName }: {
14
- collectionName: any;
15
- }): boolean;
16
- getPopulateAttribute({ collectionName }: {
17
- collectionName: any;
18
- }): true | {
19
- populate: never;
20
- } | undefined;
21
- getIndexItemId({ collectionName, itemId }: {
22
- collectionName: any;
23
- itemId: any;
24
- }): string;
25
- getCurrentIndexName(indexPrefix?: string): Promise<string>;
26
- getIncrementedIndexName(indexPrefix?: string): Promise<string>;
27
- storeCurrentIndexName(indexName: any, indexPrefix?: string): Promise<void>;
28
- modifySubfieldsConfigForExtractor(collectionConfig: any): any;
29
- extractDataToIndex({ collectionName, data, collectionConfig }: {
30
- collectionName: any;
31
- data: any;
32
- collectionConfig: any;
33
- }): {};
34
- };
4
+ }) => HelperService;
35
5
  export default _default;
@@ -7,13 +7,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
9
  const defaultIndexPrefix = 'strapi-plugin-elasticsearch-index';
10
- const getPluginStore = () => {
11
- return strapi.store({
12
- environment: '',
13
- type: 'plugin',
14
- name: 'elasticsearch',
15
- });
16
- };
17
10
  const getModelPopulationAttributes = (model) => {
18
11
  if (model.uid === 'plugin::upload.file') {
19
12
  const { related, ...attributes } = model.attributes;
@@ -165,115 +158,117 @@ function extractSubfieldData({ config, data }) {
165
158
  }
166
159
  return returnData;
167
160
  }
168
- exports.default = ({ strapi }) => ({
169
- async getElasticsearchInfo() {
170
- const configureService = strapi.plugins['elasticsearch'].services.configureIndexing;
171
- const esInterface = strapi.plugins['elasticsearch'].services.esInterface;
172
- const pluginConfig = await strapi.config.get('plugin.elasticsearch');
173
- const connected = pluginConfig.searchConnector && pluginConfig.searchConnector.host ? await esInterface.checkESConnection() : false;
174
- return {
175
- indexingCronSchedule: pluginConfig.indexingCronSchedule || 'Not configured',
176
- elasticHost: pluginConfig.searchConnector ? pluginConfig.searchConnector.host || 'Not configured' : 'Not configured',
177
- elasticUserName: pluginConfig.searchConnector ? pluginConfig.searchConnector.username || 'Not configured' : 'Not configured',
178
- elasticCertificate: pluginConfig.searchConnector ? pluginConfig.searchConnector.certificate || 'Not configured' : 'Not configured',
179
- elasticIndexAlias: pluginConfig.indexAliasName || 'Not configured',
180
- connected: connected,
181
- initialized: configureService.isInitialized(),
182
- };
183
- },
184
- isCollectionDraftPublish({ collectionName }) {
185
- const model = strapi.getModel(collectionName);
186
- return model.attributes.publishedAt ? true : false;
187
- },
188
- getPopulateAttribute({ collectionName }) {
189
- //TODO : We currently have set populate to upto 4 levels, should
190
- //this be configurable or a different default value?
191
- return getFullPopulateObject(collectionName, 4, []);
192
- },
193
- getIndexItemId({ collectionName, itemId }) {
194
- return collectionName + '::' + itemId;
195
- },
196
- async getCurrentIndexName(indexPrefix = defaultIndexPrefix) {
197
- const pluginStore = getPluginStore();
198
- const settings = (await pluginStore.get({ key: 'configsettings' }));
199
- let indexName = indexPrefix + '_000001';
200
- if (settings) {
201
- const objSettings = JSON.parse(settings);
202
- if (Object.keys(objSettings).includes('indexConfig')) {
203
- const idxConfig = objSettings['indexConfig'];
204
- if (idxConfig[indexPrefix]) {
205
- indexName = idxConfig[indexPrefix];
206
- }
207
- }
208
- }
209
- return indexName;
210
- },
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');
215
- },
216
- async storeCurrentIndexName(indexName, indexPrefix = defaultIndexPrefix) {
217
- const pluginStore = getPluginStore();
218
- const settings = (await pluginStore.get({ key: 'configsettings' }));
219
- if (settings) {
220
- const objSettings = JSON.parse(settings);
221
- objSettings['indexConfig'] = {
222
- ...objSettings['indexConfig'],
223
- [indexPrefix]: indexName,
161
+ exports.default = ({ strapi }) => {
162
+ const getEsInterface = () => strapi.plugins['elasticsearch'].services.esInterface;
163
+ return {
164
+ async getElasticsearchInfo() {
165
+ const configureService = strapi.plugins['elasticsearch'].services.configureIndexing;
166
+ const pluginConfig = await strapi.config.get('plugin.elasticsearch');
167
+ const connected = pluginConfig.searchConnector && pluginConfig.searchConnector.host ? await getEsInterface().checkESConnection() : false;
168
+ return {
169
+ indexingCronSchedule: pluginConfig.indexingCronSchedule || 'Not configured',
170
+ elasticHost: pluginConfig.searchConnector ? pluginConfig.searchConnector.host || 'Not configured' : 'Not configured',
171
+ elasticUserName: pluginConfig.searchConnector ? pluginConfig.searchConnector.username || 'Not configured' : 'Not configured',
172
+ elasticCertificate: pluginConfig.searchConnector ? pluginConfig.searchConnector.certificate || 'Not configured' : 'Not configured',
173
+ elasticIndexAlias: pluginConfig.indexAliasName || 'Not configured',
174
+ connected: connected,
175
+ initialized: configureService.isInitialized(),
224
176
  };
225
- await pluginStore.set({ key: 'configsettings', value: JSON.stringify(objSettings) });
226
- }
227
- else {
228
- const newSettings = JSON.stringify({ indexConfig: { [indexPrefix]: indexName } });
229
- await pluginStore.set({ key: 'configsettings', value: newSettings });
230
- }
231
- },
232
- modifySubfieldsConfigForExtractor(collectionConfig) {
233
- const collectionName = Object.keys(collectionConfig)[0];
234
- const attributes = Object.keys(collectionConfig[collectionName]);
235
- for (let r = 0; r < attributes.length; r++) {
236
- const attr = attributes[r];
237
- const attribFields = Object.keys(collectionConfig[collectionName][attr]);
238
- if (attribFields.includes('subfields')) {
239
- const subfielddata = collectionConfig[collectionName][attr]['subfields'];
240
- if (subfielddata.length > 0) {
241
- try {
242
- const subfieldjson = JSON.parse(subfielddata);
243
- if (Object.keys(subfieldjson).includes('subfields'))
244
- collectionConfig[collectionName][attr]['subfields'] = subfieldjson['subfields'];
245
- }
246
- catch (err) {
247
- continue;
177
+ },
178
+ isCollectionDraftPublish({ collectionName }) {
179
+ const model = strapi.getModel(collectionName);
180
+ return model.attributes.publishedAt ? true : false;
181
+ },
182
+ getPopulateAttribute({ collectionName }) {
183
+ //TODO : We currently have set populate to upto 4 levels, should
184
+ //this be configurable or a different default value?
185
+ return getFullPopulateObject(collectionName, 4, []);
186
+ },
187
+ getIndexItemId({ collectionName, itemId }) {
188
+ return collectionName + '::' + itemId;
189
+ },
190
+ async getCurrentIndexName(indexPrefix = defaultIndexPrefix) {
191
+ const indices = await getEsInterface().listIndicesByPattern(indexPrefix + '_*');
192
+ if (indices.length === 0) {
193
+ return indexPrefix + '_000000';
194
+ }
195
+ const sortedIndices = indices.sort(sortByIndexNumber(indexPrefix)).reverse();
196
+ return sortedIndices[0];
197
+ },
198
+ async getIncrementedIndexName(indexPrefix = defaultIndexPrefix) {
199
+ const currentIndexName = await this.getCurrentIndexName(indexPrefix);
200
+ const number = parseInt(currentIndexName.split(indexPrefix + '_')[1]);
201
+ return indexPrefix + '_' + String(number + 1).padStart(6, '0');
202
+ },
203
+ async deleteOldIndices(indexPrefix = defaultIndexPrefix) {
204
+ const esInterface = getEsInterface();
205
+ const indices = await esInterface.listIndicesByPattern(indexPrefix + '_*');
206
+ const sortedIndices = indices.sort(sortByIndexNumber(indexPrefix)).reverse();
207
+ const indicesToDelete = sortedIndices.slice(1);
208
+ for (let index of indicesToDelete) {
209
+ await esInterface.deleteIndex(index);
210
+ }
211
+ return indicesToDelete;
212
+ },
213
+ modifySubfieldsConfigForExtractor(collectionConfig) {
214
+ const collectionName = Object.keys(collectionConfig)[0];
215
+ const attributes = Object.keys(collectionConfig[collectionName]);
216
+ for (let r = 0; r < attributes.length; r++) {
217
+ const attr = attributes[r];
218
+ const attribFields = Object.keys(collectionConfig[collectionName][attr]);
219
+ if (attribFields.includes('subfields')) {
220
+ const subfielddata = collectionConfig[collectionName][attr]['subfields'];
221
+ if (subfielddata.length > 0) {
222
+ try {
223
+ const subfieldjson = JSON.parse(subfielddata);
224
+ if (Object.keys(subfieldjson).includes('subfields'))
225
+ collectionConfig[collectionName][attr]['subfields'] = subfieldjson['subfields'];
226
+ }
227
+ catch (err) {
228
+ continue;
229
+ }
248
230
  }
249
231
  }
250
232
  }
251
- }
252
- return collectionConfig;
253
- },
254
- extractDataToIndex({ collectionName, data, collectionConfig }) {
255
- collectionConfig = this.modifySubfieldsConfigForExtractor(collectionConfig);
256
- const fti = Object.keys(collectionConfig[collectionName]);
257
- const document = {};
258
- for (let k = 0; k < fti.length; k++) {
259
- const fieldConfig = collectionConfig[collectionName][fti[k]];
260
- if (fieldConfig.index) {
261
- let val = null;
262
- if (Object.keys(fieldConfig).includes('subfields')) {
263
- val = extractSubfieldData({ config: fieldConfig['subfields'], data: data[fti[k]] });
264
- val = val ? val.trim() : val;
265
- }
266
- else {
267
- val = data[fti[k]];
268
- if (Object.keys(fieldConfig).includes('transform') && fieldConfig['transform'] === 'markdown')
269
- val = transform_content_1.default.transform({ content: val, from: 'markdown' });
233
+ return collectionConfig;
234
+ },
235
+ extractDataToIndex({ collectionName, data, collectionConfig }) {
236
+ collectionConfig = this.modifySubfieldsConfigForExtractor(collectionConfig);
237
+ const fti = Object.keys(collectionConfig[collectionName]);
238
+ const document = {};
239
+ for (let k = 0; k < fti.length; k++) {
240
+ const fieldConfig = collectionConfig[collectionName][fti[k]];
241
+ if (fieldConfig.index) {
242
+ let val = null;
243
+ if (Object.keys(fieldConfig).includes('subfields')) {
244
+ val = extractSubfieldData({ config: fieldConfig['subfields'], data: data[fti[k]] });
245
+ val = val ? val.trim() : val;
246
+ }
247
+ else {
248
+ val = data[fti[k]];
249
+ if (Object.keys(fieldConfig).includes('transform') && fieldConfig['transform'] === 'markdown')
250
+ val = transform_content_1.default.transform({ content: val, from: 'markdown' });
251
+ }
252
+ if (Object.keys(fieldConfig).includes('searchFieldName'))
253
+ document[fieldConfig['searchFieldName']] = val;
254
+ else
255
+ document[fti[k]] = val;
270
256
  }
271
- if (Object.keys(fieldConfig).includes('searchFieldName'))
272
- document[fieldConfig['searchFieldName']] = val;
273
- else
274
- document[fti[k]] = val;
275
257
  }
276
- }
277
- return document;
278
- },
279
- });
258
+ return document;
259
+ },
260
+ };
261
+ };
262
+ /**
263
+ * sort index names by index number, e.g:
264
+ * restaurants_000001, restaurants_000002, restaurants_000003
265
+ * @param indexPrefix index alias, usually
266
+ * @returns
267
+ */
268
+ function sortByIndexNumber(indexPrefix) {
269
+ return (a, b) => {
270
+ const numA = parseInt(a.split(indexPrefix + '_')[1]);
271
+ const numB = parseInt(b.split(indexPrefix + '_')[1]);
272
+ return numA - numB;
273
+ };
274
+ }
@@ -59,38 +59,7 @@ declare const _default: {
59
59
  };
60
60
  helper: ({ strapi }: {
61
61
  strapi: any;
62
- }) => {
63
- getElasticsearchInfo(): Promise<{
64
- indexingCronSchedule: any;
65
- elasticHost: any;
66
- elasticUserName: any;
67
- elasticCertificate: any;
68
- elasticIndexAlias: any;
69
- connected: any;
70
- initialized: any;
71
- }>;
72
- isCollectionDraftPublish({ collectionName }: {
73
- collectionName: any;
74
- }): boolean;
75
- getPopulateAttribute({ collectionName }: {
76
- collectionName: any;
77
- }): true | {
78
- populate: never;
79
- } | undefined;
80
- getIndexItemId({ collectionName, itemId }: {
81
- collectionName: any;
82
- itemId: any;
83
- }): string;
84
- getCurrentIndexName(indexPrefix?: string): Promise<string>;
85
- getIncrementedIndexName(indexPrefix?: string): Promise<string>;
86
- storeCurrentIndexName(indexName: any, indexPrefix?: string): Promise<void>;
87
- modifySubfieldsConfigForExtractor(collectionConfig: any): any;
88
- extractDataToIndex({ collectionName, data, collectionConfig }: {
89
- collectionName: any;
90
- data: any;
91
- collectionConfig: any;
92
- }): {};
93
- };
62
+ }) => import("../types/helper-service.type").HelperService;
94
63
  transformContent: {
95
64
  transform({ content, from }: {
96
65
  content: any;
@@ -31,11 +31,9 @@ exports.default = ({ strapi }) => ({
31
31
  //Step 4 : Move the alias to this new index
32
32
  await esInterface.attachAliasToIndex(newIndexName);
33
33
  console.log('strapi-plugin-elasticsearch : Attaching the newly created index to the alias.');
34
- //Step 3 : Update the search-indexing-name
35
- await helper.storeCurrentIndexName(newIndexName);
36
- console.log('strapi-plugin-elasticsearch : Deleting the previous index : ', oldIndexName);
34
+ console.log('strapi-plugin-elasticsearch : Deleting the previous indices');
37
35
  //Step 5 : Delete the previous index
38
- await esInterface.deleteIndex(oldIndexName);
36
+ await helper.deleteOldIndices();
39
37
  await logIndexingService.recordIndexingPass('Request to immediately re-index site-wide content completed successfully.');
40
38
  return true;
41
39
  }
@@ -30,8 +30,8 @@ exports.default = ({ strapi }) => {
30
30
  const itemData = results[0];
31
31
  const esInterface = getElasticsearchService();
32
32
  const helper = getHelperService();
33
- const indexItemId = helper.getIndexItemId(collectionName, itemId);
34
- const indexName = await helper.getCurrentIndexName();
33
+ const indexItemId = helper.getIndexItemId({ collectionName, itemId });
34
+ const indexName = await helper.getCurrentIndexName(collection.indexAlias);
35
35
  await esInterface.indexDataToSpecificIndex({ itemId: indexItemId, itemData }, indexName);
36
36
  strapi.log.debug(`Indexed virtual item: ${collectionName}:${itemId}`);
37
37
  return itemData;
@@ -57,14 +57,19 @@ exports.default = ({ strapi }) => {
57
57
  */
58
58
  async reindex(collection) {
59
59
  const collectionName = collection.collectionName;
60
- const indexAlias = collection.indexAlias;
60
+ const privateIndexAlias = collection.indexAlias;
61
61
  const helper = getHelperService();
62
- const oldIndexName = await helper.getCurrentIndexName(indexAlias);
63
- const newIndexName = await helper.getIncrementedIndexName(indexAlias);
64
62
  let timestamp = Date.now();
65
63
  try {
66
64
  const esInterface = getElasticsearchService();
67
- await esInterface.createIndex(newIndexName, collection.mappings);
65
+ let indexName;
66
+ if (privateIndexAlias) {
67
+ indexName = await helper.getIncrementedIndexName(privateIndexAlias);
68
+ await esInterface.createIndex(indexName, collection.mappings);
69
+ }
70
+ else {
71
+ indexName = await helper.getCurrentIndexName();
72
+ }
68
73
  let page = 0;
69
74
  let hasMoreData = true;
70
75
  let totalIndexed = 0;
@@ -80,19 +85,20 @@ exports.default = ({ strapi }) => {
80
85
  operations.push({ itemId, itemData });
81
86
  }
82
87
  if (operations.length > 0) {
83
- await Promise.all(operations.map((op) => esInterface.indexDataToSpecificIndex(op, newIndexName)));
88
+ await Promise.all(operations.map((op) => esInterface.indexDataToSpecificIndex(op, indexName)));
84
89
  }
85
90
  totalIndexed += pageData.length;
86
91
  page++;
87
92
  }
88
93
  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)}`);
94
+ if (privateIndexAlias) {
95
+ timestamp = Date.now();
96
+ await esInterface.attachAliasToIndex(indexName, privateIndexAlias, collection.mappings);
97
+ strapi.log.info(`Done attachAliasToIndex alias ${privateIndexAlias} to index ${indexName}. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)}`);
98
+ timestamp = Date.now();
99
+ const oldIndicesDeleted = await helper.deleteOldIndices(privateIndexAlias);
100
+ strapi.log.info(`Done deleting ${oldIndicesDeleted.length} old indices: ${oldIndicesDeleted}. took ${(0, humanize_duration_1.default)(Date.now() - timestamp)}`);
101
+ }
96
102
  return totalIndexed;
97
103
  }
98
104
  catch (error) {
@@ -69,4 +69,5 @@ export interface EsInterfaceService {
69
69
  * @returns A promise that resolves with the search results.
70
70
  */
71
71
  searchData(searchQuery: any): Promise<any>;
72
+ listIndicesByPattern(pattern: string): Promise<string[]>;
72
73
  }
@@ -0,0 +1,33 @@
1
+ export type ElasticsearchInfo = {
2
+ indexingCronSchedule: string;
3
+ elasticHost: string;
4
+ elasticUserName: string;
5
+ elasticCertificate: string;
6
+ elasticIndexAlias: number;
7
+ connected: string;
8
+ initialized: boolean;
9
+ };
10
+ export interface HelperService {
11
+ getElasticsearchInfo(): Promise<ElasticsearchInfo>;
12
+ isCollectionDraftPublish(args: {
13
+ collectionName: string;
14
+ }): boolean;
15
+ getPopulateAttribute(args: {
16
+ collectionName: string;
17
+ }): true | {
18
+ populate: object;
19
+ } | undefined;
20
+ getIndexItemId(args: {
21
+ collectionName: string;
22
+ itemId: number;
23
+ }): string;
24
+ getCurrentIndexName(indexAlias?: string): Promise<string>;
25
+ getIncrementedIndexName(indexPrefix: string): Promise<string>;
26
+ deleteOldIndices(indexAlias?: string): Promise<string[]>;
27
+ modifySubfieldsConfigForExtractor(collectionConfig: object): object;
28
+ extractDataToIndex(args: {
29
+ collectionName: string;
30
+ data: object;
31
+ collectionConfig: object;
32
+ }): any;
33
+ }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ let a = {
4
+ a: 1,
5
+ };
6
+ const example = { foo: "bar" };
7
+ a = example;
@@ -1,12 +1,16 @@
1
1
  import { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types';
2
2
  export type VirtualCollectionConfig<T extends StrapiEntity> = {
3
3
  /**
4
+ * Optional -
4
5
  * The alias of the latest index in Elasticsearch.
5
6
  * It also serves as a prefix to actual indexes created in Elasticsearch.
6
7
  * The actuall index name will be the `${indexNameBase}_${ind}`, e.g `restaurants_000001` and so on.
7
8
  * and the alias will be the `indexNameBase`.
9
+ *
10
+ * If you don't provide this, the default index name will be used as the alias.
11
+ * Omit this property if you want to use the default index for all collections.
8
12
  */
9
- indexAlias: string;
13
+ indexAlias?: string;
10
14
  collectionName: string;
11
15
  extractData: (page: number, pageSize?: number) => Promise<T[]>;
12
16
  extractById: (ids: number[]) => Promise<T[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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": {
@@ -61,4 +61,4 @@
61
61
  "ts-node": "^10.9.2",
62
62
  "typescript": "^5.8.3"
63
63
  }
64
- }
64
+ }