我想使用ElasticSearch来索引移动应用数据。 所以我的文档是映射的GooglePlay包:
"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"
}
}
]
当用户输入ski
时,我想建议Poweramp skin STEEL I. Yellow
。
我尝试使用match
查询,但这仅适用于整个单词,并且无法使用大小写。
因此"match":"skin"
有效,但"match":"sKIn"
和"match":"ski"
不会返回结果
我该如何解决?