enable configuration of indexPrefix
Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
@@ -21,6 +21,10 @@ export interface Config {
|
||||
* Options for ElasticSearch
|
||||
*/
|
||||
elasticsearch?: {
|
||||
/**
|
||||
* Prefix to be used for all index creation. Value will be put in front of the index as is.
|
||||
*/
|
||||
indexPrefix?: string;
|
||||
/**
|
||||
* Batch size for elastic search indexing tasks. Defaults to 1000.
|
||||
*/
|
||||
|
||||
+2
-2
@@ -140,7 +140,7 @@ export class ElasticSearchSearchEngineIndexer extends BatchSearchEngineIndexer {
|
||||
// does not occur, and clean up the empty index we just created.
|
||||
if (this.processed === 0) {
|
||||
this.logger.warn(
|
||||
`Index for ${this.type} was not ${
|
||||
`Index for ${this.indexName} was not ${
|
||||
this.removableIndices.length ? 'replaced' : 'created'
|
||||
}: indexer received 0 documents`,
|
||||
);
|
||||
@@ -158,7 +158,7 @@ export class ElasticSearchSearchEngineIndexer extends BatchSearchEngineIndexer {
|
||||
// stale indices can be referenced for deletion in case initial attempt
|
||||
// fails. Allow errors to bubble up so that we can clean up the created index.
|
||||
this.logger.info(
|
||||
`Indexing completed for index ${this.type} in ${duration(
|
||||
`Indexing completed for index ${this.indexName} in ${duration(
|
||||
this.startTimestamp,
|
||||
)}`,
|
||||
result,
|
||||
|
||||
@@ -76,12 +76,20 @@ export default createBackendModule({
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const indexPrefix = config.getOptionalString(
|
||||
'search.elasticsearch.indexPrefix',
|
||||
);
|
||||
if (indexPrefix) {
|
||||
logger.info(
|
||||
`Preceeding all indices with index prefix: ${indexPrefix}`,
|
||||
);
|
||||
}
|
||||
searchEngineRegistry.setSearchEngine(
|
||||
await ElasticSearchSearchEngine.fromConfig({
|
||||
logger,
|
||||
config,
|
||||
translator,
|
||||
indexPrefix,
|
||||
}),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user