我正试图从多字段中获取建议.我找不到这样的例子,所以也许这不是最好的主意,但我对你的意见很感兴趣.
制图:
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
}
}
}
}
}
}
}
数据:
POST /authors/author/1
{
"name": "Fyodor Dostoevsky"
}
查询:
POST /authors/_suggest
{
"authorsAutocomplete": {
"text": "fyodor",
"completion": {
"field": "name.ac"
}
}
}
要求是:
任何想法我怎样才能实现这些?