Unverified Commit d8922440 authored by scienceasdf's avatar scienceasdf Committed by GitHub

feat: set analyzer for elasticsearch (#2793)

* Feature: Custom configuration for elasticsearch For better search results especially in Chinese, which the standard token analyzer may not work well. * Set default analyzer in settings when building index * Remove dangling comma
parent 3fddfd69
...@@ -26,16 +26,22 @@ props: ...@@ -26,16 +26,22 @@ props:
hint: The index name to use during creation hint: The index name to use during creation
default: wiki default: wiki
order: 3 order: 3
analyzer:
type: String
title: Analyzer
hint: 'The token analyzer in elasticsearch'
default: simple
order: 4
sniffOnStart: sniffOnStart:
type: Boolean type: Boolean
title: Sniff on start title: Sniff on start
hint: 'Should Wiki.js attempt to detect the rest of the cluster on first connect? (Default: off)' hint: 'Should Wiki.js attempt to detect the rest of the cluster on first connect? (Default: off)'
default: false default: false
order: 4 order: 5
sniffInterval: sniffInterval:
type: Number type: Number
title: Sniff Interval title: Sniff Interval
hint: '0 = disabled, Interval in seconds to check for updated list of nodes in cluster. (Default: 0)' hint: '0 = disabled, Interval in seconds to check for updated list of nodes in cluster. (Default: 0)'
default: 0 default: 0
order: 5 order: 6
...@@ -70,7 +70,16 @@ module.exports = { ...@@ -70,7 +70,16 @@ module.exports = {
body: { body: {
mappings: (this.config.apiVersion === '6.x') ? { mappings: (this.config.apiVersion === '6.x') ? {
_doc: idxBody _doc: idxBody
} : idxBody } : idxBody,
settings: {
analysis: {
analyzer: {
default: {
type: this.config.analyzer
}
}
}
}
} }
}) })
} catch (err) { } catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment