美好的一天:
我正在尝试对ElasticSearch进行自动完成。目前,我有一个映射为建议的字段。我有以下查询:
POST dev/facility/_search
{
"suggest": {
"song-suggest" : {
"prefix" : "faci",
"completion" : {
"field" :"suggest"
}
}
}
}
但是,我收到此错误:no mapping found for field [suggest]
。可以在此处看到我的映射:
{
"dev": {
"mappings": {
"facility": {
"properties": {
"slug": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"state": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"suggest": {
"properties": {
"input": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
}
}
我已使用NEST生成映射,这是我在字段上的注释:
[Completion]
public CompletionField Suggest { get; set;