From b6434bd4258dfb5c39152e5437daf98677d4396d Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Sat, 12 Oct 2024 04:31:58 -0400 Subject: [PATCH] fix: Update engine.js --- server/modules/search/elasticsearch/engine.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/modules/search/elasticsearch/engine.js b/server/modules/search/elasticsearch/engine.js index 9c070059..0daf0037 100644 --- a/server/modules/search/elasticsearch/engine.js +++ b/server/modules/search/elasticsearch/engine.js @@ -83,9 +83,9 @@ module.exports = { await this.client.indices.create({ index: this.config.indexName, body: { - mappings: { + mappings: (this.config.apiVersion === '6.x') ? { _doc: idxBody - }, + } : idxBody, settings: { analysis: { analyzer: { @@ -229,7 +229,7 @@ module.exports = { async created(page) { await this.client.index({ index: this.config.indexName, - ...(this.config.apiVersion !== '8.x' && {type: '_doc'}), + ...(this.config.apiVersion !== '8.x' && { type: '_doc' }), id: page.hash, body: { suggest: this.buildSuggest(page), @@ -251,7 +251,7 @@ module.exports = { async updated(page) { await this.client.index({ index: this.config.indexName, - ...(this.config.apiVersion !== '8.x' && {type: '_doc'}), + ...(this.config.apiVersion !== '8.x' && { type: '_doc' }), id: page.hash, body: { suggest: this.buildSuggest(page), @@ -273,7 +273,7 @@ module.exports = { async deleted(page) { await this.client.delete({ index: this.config.indexName, - ...(this.config.apiVersion !== '8.x' && {type: '_doc'}), + ...(this.config.apiVersion !== '8.x' && { type: '_doc' }), id: page.hash, refresh: true }) @@ -286,13 +286,13 @@ module.exports = { async renamed(page) { await this.client.delete({ index: this.config.indexName, - ...(this.config.apiVersion !== '8.x' && {type: '_doc'}), + ...(this.config.apiVersion !== '8.x' && { type: '_doc' }), id: page.hash, refresh: true }) await this.client.index({ index: this.config.indexName, - ...(this.config.apiVersion !== '8.x' && {type: '_doc'}), + ...(this.config.apiVersion !== '8.x' && { type: '_doc' }), id: page.destinationHash, body: { suggest: this.buildSuggest(page), @@ -362,7 +362,7 @@ module.exports = { index: { _index: this.config.indexName, _id: doc.id, - ...(this.config.apiVersion !== '8.x' && {_type: '_doc'}) + ...(this.config.apiVersion !== '8.x' && { _type: '_doc' }) } }) doc.safeContent = WIKI.models.pages.cleanHTML(doc.render)