fix: elasticsearch partial match (#1882)

Improved full text search in elastic provider
This commit is contained in:
kaziu687 2020-05-14 01:32:28 +02:00 committed by GitHub
parent d0cd340d7e
commit 66e725f426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,10 +92,28 @@ module.exports = {
index: this.config.indexName, index: this.config.indexName,
body: { body: {
query: { query: {
bool: {
filter: [
{
bool: {
should: [
{
simple_query_string: { simple_query_string: {
query: q query: q
} }
}, },
{
query_string: {
query: "*" + q + "*"
}
}
],
minimum_should_match: 1
}
}
]
}
},
from: 0, from: 0,
size: 50, size: 50,
_source: ['title', 'description', 'path', 'locale'], _source: ['title', 'description', 'path', 'locale'],