gpt4 book ai didi

elasticsearch - Elasticsearch:搜索类似产品

转载 作者:行者123 更新时间:2023-12-03 00:10:03 25 4
gpt4 key购买 nike

我列出了5000万种产品。每个产品都有200个功能的列表。我希望通过匹配在200个功能中具有最大重叠量的产品功能来找到类似的产品。

目前,我将200个单词用空格连接起来,并形成一个长字符串。当我想为特定的选定产品找到类似的产品时,我检索存储的200个单词长的字符串并搜索elasticsearch。

这样可以得到预期的结果,但是每次搜索大约需要7秒钟。那是因为搜索词很长。有没有更好的方法来做到这一点,并找到最佳的 flex 重叠?

最佳答案

我建议您检查/尝试一些事情:

I have a list of 50 million products. Each product has a list of 200 features. I am looking to find similar products by matching product features which has maximum overlap across the 200 features. Currently I concatenate the 200 words with spaces and form a long string.



假设Product是Doc类型,您可以尝试将功能正常保存为值数组和 enabling field data。然后,可以使用 aggregations轻松地对它们进行分组,并使用适当的提到的最大重叠量来获得所需的内容。我坚信这会更快。

I retrieve the stored 200 words long string and search elasticsearch.



在某些情况下,您可能想要的只是聚合结果,而不是所有产品或其他文档类型的完整响应,在这种情况下,请将搜索类型设置为count(旧版本)或size_0(新版本)的query_then_fetch,并避免使用初始获取所有文档类型并仅获取汇总,这可以根据您的要求在某些情况下使用。

确保您拥有 elasticsearch environment proper prepared

最后,有了如此多的文档,您就有机会找到比默认情况更适合自己的情况的 shard /replicas configuration

关于elasticsearch - Elasticsearch:搜索类似产品,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41597027/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com