From 66e725f426c601f366137ab9ef4a3c3a8cc2b2ea Mon Sep 17 00:00:00 2001 From: kaziu687 Date: Thu, 14 May 2020 01:32:28 +0200 Subject: [PATCH] fix: elasticsearch partial match (#1882) Improved full text search in elastic provider --- server/modules/search/elasticsearch/engine.js | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/server/modules/search/elasticsearch/engine.js b/server/modules/search/elasticsearch/engine.js index b1d36e4e..0a97ed79 100644 --- a/server/modules/search/elasticsearch/engine.js +++ b/server/modules/search/elasticsearch/engine.js @@ -92,8 +92,26 @@ module.exports = { index: this.config.indexName, body: { query: { - simple_query_string: { - query: q + bool: { + filter: [ + { + bool: { + should: [ + { + simple_query_string: { + query: q + } + }, + { + query_string: { + query: "*" + q + "*" + } + } + ], + minimum_should_match: 1 + } + } + ] } }, from: 0,