短语搜索Elasticsearch中的多词同义词

时间:2020-11-05 08:27:44

标签: elasticsearch synonym

是否可以在Elasticsearch中对多词同义词进行短语搜索?

假设我有这个同义词:

strip steak bacon, ssb, strip-steak bacon

文档中的文本:

Kevin burgdoggen turkey, spare ribs pancetta pastrami drumstick strip steak bacon beef ribs pork. 
Jowl sirloin tenderloin hamburger alcatra short loin biltong cow doner ribeye tri-tip sausage bacon 
capicola pork. Filet mignon meatloaf shoulder cupim tongue meatball. Shankle cow strip steak tail pig
buffalo pork picanha cupim porchetta kielbasa beef. Ground round pork loin filet mignon turducken.
Beef pancetta buffalo strip steak, ground round salami flank porchetta hamburger chicken turducken 
venison sirloin pastrami.

我简单简单地查询ssb的索引:

"query": {
    "match": {
      "body": "all the ssb are belong to us"
    }
}

然后我希望将其解释为:

all the "strip steak bacon" are belong to us

否则,我将基于所有单词(all, the, strip, steak, bacon, are, belong, to, us)获得结果和突出显示。

这甚至有可能做到吗?我试图找到有关此文档的文档,但是它们都使用定向同义词(strip steak bacon => ssb)进行了另一种选择。现在,我正在认真考虑将其添加到我的应用程序逻辑中,而不是在Elasticsearch中进行此操作,并手动替换查询中的ssb,这真是个坏主意。

0 个答案:

没有答案