I'm trying to get suggestions from a multifield. I can't find examples like this, so maybe it's not the best idea, but I'm interested in your opinion.
mapping:
POST /authors
{
"mappings": {
"author": {
"properties": {
"name": {
"type": "multi_field",
"fields": {
"name": {
"type": "string",
"index": "analyzed"
},
"ac": {
"type": "completion",
"index_analyzer": "simple",
"search_analyzer": "simple",
"payloads": true
}
}
}
}
}
}
}
data:
POST /authors/author/1
{
"name": "Fyodor Dostoevsky"
}
query:
POST /authors/_suggest
{
"authorsAutocomplete": {
"text": "fyodor",
"completion": {
"field": "name.ac"
}
}
}
Requirements are:
- get query works with text "fyodor" and also with "dostoevsky", this example works only with "fyodor"
- be enable to filter suggestions
any ideas how can I achieve these?