Autocomplete 在弹性搜索中创建自动完成
我想使用ElasticSearch索引移动应用程序数据。 所以我的文档是Google Play地图包:Autocomplete 在弹性搜索中创建自动完成,autocomplete,elasticsearch,Autocomplete,elasticsearch,我想使用ElasticSearch索引移动应用程序数据。 所以我的文档是Google Play地图包: "application": { "_id": { "path": "code" }, "properties": { "code": { "type": "string" },
"application": {
"_id": {
"path": "code"
},
"properties": {
"code": {
"type": "string"
},
"name": {
"type": "string"
},
"url": {
"type": "string",
"index": "no"
},
"thumbnail": {
"type": "string",
"index": "no"
},
"category": {
"type": "string",
"index": "not_analyzed"
},
"updated_as_of": {
"type": "date",
"format": "dd-MM-yyyy HH:mm:ss"
}
}
}
然后,当有人开始键入应用程序的名称时,我想创建一个建议。
因此,如果我的文件是:
[
{
"_index": "apps",
"_type": "application",
"_id": "com.maxmpz.poweramp.skins.ironyellowmetalmachine",
"_score": 1,
"_source": {
"category": "Music & Audio",
"updated_as_of": "25-11-2014 12:07:58",
"name": "Poweramp skin STEEL I. Yellow",
"url": "https://play.google.com/store/apps/details?id=com.maxmpz.poweramp.skins.ironyellowmetalmachine",
"code": "com.maxmpz.poweramp.skins.ironyellowmetalmachine",
"thumbnail": "https://lh6.ggpht.com/a0Osb7RQcgjyNzoK22i2V6kndab7KWis3HZ9cwXqvCFNtQNDOUMWhSSl8IcJYsL2OA=w300"
}
},
{
"_index": "apps",
"_type": "application",
"_id": "it.medieval.blueftp",
"_score": 1,
"_source": {
"category": "Communication",
"updated_as_of": "30-11-2014 15:27:39",
"name": "Bluetooth File Transfer",
"url": "https://play.google.com/store/apps/details?id=it.medieval.blueftp",
"code": "it.medieval.blueftp",
"thumbnail": "https://lh6.ggpht.com/emp6MlSfqJhZBlhsU4hbQN2jJnXszciwb1QSumuUzl1zWj2aBYoZZHe_e9td8aOCb_U=w300"
}
}
]
根据用户类型,我建议使用Poweramp skin STEEL I.黄色
我试着只使用匹配查询,但这只适用于整个单词,而且无法大写。
所以match:skin是有效的,但是match:skin和match:ski并没有结果
如何解决这个问题?我建议阅读Qbox,我们已经就这个问题发表了几篇博客文章。一个是非常快速和简单的:另一个是有点复杂:。希望能有帮助。我也同意第一条评论,这就是我从一开始就学会如何做的原因谢谢斯隆。“那篇博文很棒,很有魅力。”斯洛阿纳伦斯:链接没有打开。