(back) Suggester: Change ELS search analyzer for specific char
Implementing search in dashboard revealed problems when search with specific char (francois perusse) Note: it's also possible to specify an analyzer for ingestion (cherry picked from commit 24da127750c995c55d54876a1be8a4ad3bf9ce9c)
This commit is contained in:
60
suggester.es
60
suggester.es
@@ -30,13 +30,15 @@ PUT /itunes-suggest
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"artist_suggest": {
|
||||
"type": "completion"
|
||||
"type": "completion",
|
||||
"search_analyzer": "names"
|
||||
},
|
||||
"artist": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"album_suggest": {
|
||||
"type": "completion"
|
||||
"type": "completion",
|
||||
"search_analyzer": "names"
|
||||
},
|
||||
"album": {
|
||||
"type": "keyword"
|
||||
@@ -45,6 +47,8 @@ PUT /itunes-suggest
|
||||
}
|
||||
}
|
||||
|
||||
// Also possible to specify analyze for ingesting => https://stackoverflow.com/questions/48304499/elasticsearch-completion-suggester-not-working-with-whitespace-analyzer
|
||||
|
||||
// Problem with word EP, SP
|
||||
|
||||
GET itunes-suggest/_analyze
|
||||
@@ -53,6 +57,8 @@ GET itunes-suggest/_analyze
|
||||
"text": "the servent"
|
||||
}
|
||||
|
||||
GET itunes-suggest/_search
|
||||
|
||||
POST itunes-suggest/_search
|
||||
{
|
||||
"_source" : "artist",
|
||||
@@ -79,3 +85,53 @@ POST itunes-suggest/_search
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
POST itunes-suggest/_search
|
||||
{
|
||||
"_source": ["album", "artist"],
|
||||
"suggest": {
|
||||
"alb-suggest": {
|
||||
"prefix": "sou",
|
||||
"completion": {
|
||||
"field": "album_suggest"
|
||||
}
|
||||
},
|
||||
"ar-suggest": {
|
||||
"prefix": "sou",
|
||||
"completion": {
|
||||
"field": "artist_suggest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
POST itunes-suggest/_search
|
||||
{
|
||||
"_source": ["album", "artist"],
|
||||
"suggest": {
|
||||
"alb-suggest": {
|
||||
"prefix": "Francois",
|
||||
"completion": {
|
||||
"field": "album_suggest"
|
||||
}
|
||||
},
|
||||
"ar-suggest": {
|
||||
"prefix": "Francois",
|
||||
"completion": {
|
||||
"field": "artist_suggest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
POST itunes-suggest/_search
|
||||
{
|
||||
"suggest": {
|
||||
"ar-suggest": {
|
||||
"prefix": "Femme",
|
||||
"completion": {
|
||||
"field": "artist_suggest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user