【发布时间】:2016-03-30 09:37:25
【问题描述】:
在弹性搜索中使用下一个默认设置创建索引后:
{ "autosuggest_destination": {
"aliases": {},
"mappings": {
"destination": {
"properties": {
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"id": {
"type": "string"
},
"state": {
"type": "string"
}
}
}
},
"settings": {
"index": {
"creation_date": "1459329252404",
"number_of_shards": "1",
"number_of_replicas": "0",
"version": {
"created": "1070299"
},
"uuid": "_1D7ZW0dQwy9kiKn0kKrLw"
}
},
"warmers": {} } }
将数据插入索引并验证后。
我在尝试搜索自动完成单词时遇到了这个问题:
当我尝试搜索“新”时,它会找到匹配项(纽约)。但如果我 尝试在'new y'之后添加一个空格和第一个字母,它发现 没有。在它尝试在“新”之后添加一个空格和两个字母之后 哟'它有效。
主要问题是理解为什么单词后面的第一个字母 空格不匹配?
示例:
GET autosuggest_destination/destination/_search { "query": {
"match": {
"city": {
"query": "new",
"type": "phrase_prefix"
}
} }
Result : New York
GET autosuggest_destination/destination/_search { "query": {
"match": {
"city": {
"query": "new y",
"type": "phrase_prefix"
}
} }
No Result
GET autosuggest_destination/destination/_search { "query": {
"match": {
"city": {
"query": "new yo",
"type": "phrase_prefix"
}
} }
Result : New York
有人知道应该是什么问题吗?
【问题讨论】:
标签: c# elasticsearch indexing autocomplete prefix