1
我試圖在交叉字段查詢中的特定字段上實現模糊性。雖然這有點困難。如何在elasticsearch中添加模糊搜索查詢?
所以查詢應該:
- 跨領域匹配的短語。
- 匹配partNumber和條碼的精確匹配(無模糊)
- 匹配模糊條款與標題和副標題。
我到目前爲止的查詢如下 - 請注意模糊在查詢中目前爲止根本不起作用。
所以這應該匹配1個結果,即標題中的「驚人的T恤」和副標題中的藍色。 (注意拼寫錯誤)。
是否可以在索引映射級別實現模糊性?數據集中的標題和副標題非常短 - 最多可組合30-40個字符。
否則,如何將模糊添加到查詢中的標題和副標題?
{
"query": {
"multi_match": {
"query": "Bleu Amazing T-Shirt",
"fuzziness": "auto",
"operator": "and",
"fields": [
"identity.partNumber^4",
"identity.altIdentifier^4",
"identity.barcode",
"identity.mpn",
"identity.ppn",
"descriptions.title",
"descriptions.subtitle"
],
"type": "cross_fields"
}
},
"fields": [
"identity.partNumber",
"identity.barcode",
"identity.ppn",
"descriptions.title",
"descriptions.subtitle"
]
}