1
我想實現一個搜索引擎對我的網上購物網站
elasticsearch映射我測試了幾個分析儀,但我沒有看到顯着性差異之間他們。我用雪球,NGRAM,標準分析儀
我不知道產品的名稱,其分析儀套裝,並給我最好的結果,此外,我不知道是哪個搜索查詢我應該使用
這是我映射架構
產品
{
"settings": {
"analysis": {
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": ["standard", "lowercase", "stop", "kstem", "ngram"]
}
}
}
}
,
"mappings": {
"products": {
"properties": {
"id": {
"type": "integer",
"index": "no"
},
"name": {
"type": "multi_field",
"fields": {
"name": {
"type": "string"
},
"snowball": {
"type": "string",
"analyzer": "snowball"
},
"autocomplete": {
"analyzer": "autocomplete",
"type": "string"
}
}
}
}
}
}
和搜索查詢,我不t知道使用匹配查詢是好的還是不適合我的用例
{
"query": {
"multi_match": {
"fuzziness":2,
"type" : "phrase",
"query": "term",
"fields": ["name", "name.snowball",
"name.autocomplete"]
}
}
}
我沒有什麼特別的要求,只是一個搜索引擎來索引所有的產品名稱,所以哪個分析器最好你覺得呢?你說我不使用match_query?那麼哪個查詢你推薦適合我? – user3627136
要測試查詢,我說不要使用multi_match查詢,因爲您想查看搜索之間的任何區別。如果您沒有任何特殊要求,只需使用標準分析器(默認),並根據需要進行構建。如果您需要在多個字段上進行搜索,請使用multi_match,或者查看匹配查詢http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query。 html –
但我希望搜索引擎功能強大。搜索哪個查詢,你推薦?模糊,匹配,匹配+模糊,什麼? – user3627136