手机网站注册页面,网站建设英文版,软文代写发布网络,绿色食品网站开发步骤作者#xff1a;来自 Elastic piotrprz 我希望在假期里#xff0c;你们也在吃健康的东西#xff0c;而不只是甜蛋糕
假设你想提前买一些水果#xff0c;你可能不知道所有的名字#xff0c;也可能不知道你实际上想吃哪种水果#xff0c;商店的库存里有很多东西#xf…作者来自 Elastic piotrprz我希望在假期里你们也在吃健康的东西而不只是甜蛋糕假设你想提前买一些水果你可能不知道所有的名字也可能不知道你实际上想吃哪种水果商店的库存里有很多东西或者就像我一样你在国外过假期。这里可以帮上忙的是一个不错的、低成本、多语言的语义搜索。如果你在使用 Elastic Cloud Serverless你可以依赖其中的很多东西这些在一两年前并不一定具备比如 semantic_text、EIS ( Elastic Inference Service )或者来自 Jina 的多语言密集向量模型它在 EIS 中默认启用不需要让你的 GPU 吃力也不需要你提前规划 ML 节点。更多阅读Elasticsearch使用推理端点及语义搜索演示假设商店用来保存库存的索引真的非常、非常简单为了简单起见我们跳过名称、SKU 和其他内容。PUT inventory { mappings: { properties: { item: { type: semantic_text, inference_id: .jina-embeddings-v3 } } } }然后让我们用一些可以购买的商品来填充它POST inventory/_bulk?refreshtrue { index: { } } { item: cherries } { index: { } } { item: train } { index: { } } { item: bananas } { index: { } } { item: computer } { index: { } } { item: apple } { index: { } } { item: framboises } { index: { } } { item: der Apfel } { index: { } } { item: tomato } { index: { } } { item: das Auto } { index: { } } { item: bicycle } { index: { } } { item: naranjas }请注意在库存中我们保存了来自所有部门的商品而且它们使用 English、 French、 German 和 Spanish。在我们运行 POST inventory/_search 之后应该可以以随机顺序看到所有商品。但是当我想吃一些水果时在 Polish 中是 “owoce”顺便说一下这是复数 BTW那么我所需要的只是POST inventory/_search { query: { match: { item: owoce // this stands for fruit in Polish } } }我们得到的返回结果如下{ took: 251, timed_out: false, _shards: { total: 3, successful: 3, skipped: 0, failed: 0 }, hits: { total: { value: 11, relation: eq }, max_score: 0.6704586, hits: [ { _index: inventory, _id: 8EtNK5sBRerpcHC7zVrq, _score: 0.6704586, _source: { item: cherries } }, { _index: inventory, _id: 9EtNK5sBRerpcHC7zVrr, _score: 0.6327668, _source: { item: apple } }, { _index: inventory, _id: -ktNK5sBRerpcHC7zVrr, _score: 0.61157316, _source: { item: naranjas } }, { _index: inventory, _id: 8ktNK5sBRerpcHC7zVrr, _score: 0.6047706, _source: { item: bananas } }, { _index: inventory, _id: 9UtNK5sBRerpcHC7zVrr, _score: 0.60331476, _source: { item: framboises } }, { _index: inventory, _id: 9ktNK5sBRerpcHC7zVrr, _score: 0.5917518, _source: { item: der Apfel } }, { _index: inventory, _id: 90tNK5sBRerpcHC7zVrr, _score: 0.5634274, _source: { item: tomato } }, { _index: inventory, _id: -UtNK5sBRerpcHC7zVrr, _score: 0.50522983, _source: { item: bicycle } }, { _index: inventory, _id: 80tNK5sBRerpcHC7zVrr, _score: 0.5001138, _source: { item: computer } }, { _index: inventory, _id: -EtNK5sBRerpcHC7zVrr, _score: 0.48864484, _source: { item: das Auto } } ] } }这告诉我们几件事情与几年前和早期版本相比现在创建和运行语义搜索要简单得多将 semantic_text 和运行在 EIS 中的 models 结合起来让事情变得非常容易不需要安装模型不需要担心容量规划也不需要多次网络往返来获取 embeddings无论是存储还是搜索等等。如果你有一个 multi-language 模型那会非常有帮助并且可以节省翻译工作。我们知道 tomato是一种水果但也许我们不应该把它加到水果沙拉里 :slight_smile今天就到这里。我祝你有一个健康的饮食和健康的集群 :slight_smile:原文https://discuss.elastic.co/t/dec-25th-2025-en-eat-something-healthier-at-x-mas/384137