0
我在做這個查詢到我的elasticsearch服務器:模糊查詢,在整個返回特定術語的領域
{
"query": {
"multi_match" : {
"query" : "Onions",
"fields": ["title_en", "description_en"],
"fuzziness": "5"
}
},
"_source": ["title_en", "description_en", "active", "id"],
"size": 25
}
,它是工作好,結果是:
{
"took": 15,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 0.99976414,
"hits": [
{
"_index": "fmf",
"_type": "menu",
"_id": "18",
"_score": 0.99976414,
"_source": {
"description_en": "Delicious onions rings, the best flavors",
"active": true,
"title_en": "Onions rings",
"id": 18
}
},
{
"_index": "fmf",
"_type": "menu",
"_id": "16",
"_score": 0.574256,
"_source": {
"description_en": "A delectable array of our most popular starters that’s big enough to share. Served with different sauces for mixing and matching. Includes Onion Rings, Potato Skins, Tomato Bruschetta and Santa Fe Spring Rolls",
"active": true,
"title_en": "Jumbo combo veg",
"id": 16
}
}
]
}
}
正如你可以看到,發現的結果是description_en
並返回整個字段,但是存在一種只返回找到的單詞的方法? 像,如果我搜索honyons(壞書面),只返回「洋蔥」,而不是所有的領域?
你可以看看的彈性亮點功能。這可能會解決你的目的。 – user3775217
5的模糊不可能,它是AUTO,0,1或2。 –