我試圖從多字段獲取建議。我找不到像這樣的例子,所以也許這不是最好的想法,但我對你的意見感興趣。elasticsearch完成建議在多字段
映射:
POST /authors { "mappings": { "author": { "properties": { "name": { "type": "multi_field", "fields": { "name": { "type": "string", "index": "analyzed" }, "ac": { "type": "completion", "index_analyzer": "simple", "search_analyzer": "simple", "payloads": true } } } } } } }
數據:
POST /authors/author/1 { "name": "Fyodor Dostoevsky" }
查詢:
POST /authors/_suggest { "authorsAutocomplete": { "text": "fyodor", "completion": { "field": "name.ac" } } }
的要求是:
- GET查詢與文本「陀」,並與「陀思妥耶夫斯基」的作品,這個例子僅適用於「陀」
- 可以使過濾建議
任何想法如何,我可以做到這些?
從映射中刪除index_analyzer和search_analyzer。保持它只有完成類型.. – 2014-09-19 14:27:18
,沒有改變結果 – Ins 2014-10-17 08:22:03