当前位置: 首页 > news >正文

Elasticsearch:在 X-mas 吃一些更健康的东西

作者:来自 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?refresh=true { "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

http://www.zskr.cn/news/156350.html

相关文章:

  • LocalAI开源本地部署终极指南:5分钟搭建专属AI助手
  • ControlNet++ SDXL ProMax终极指南:高效配置与性能翻倍的AI绘图解决方案
  • Figma MCP终极配置指南:3步实现AI精准代码生成
  • 打造专业级有声读物:电子书转换创作完全指南
  • PaddlePaddle YOLOv4性能优化实战:速度与精度平衡
  • gmpublisher:彻底改变Garry‘s Mod模组发布体验的终极工具
  • 2025年12月徐州别墅设计服务商推荐榜单 - 2025年品牌推荐榜
  • PaddlePaddle注意力机制实现教程:Attention from Scratch
  • Renamer终极指南:5分钟掌握高效文件批量重命名技巧
  • 2025年口碑好的连续冲模五金冲压人气实力厂商推荐 - 行业平台推荐
  • 零代码建站神器:Hugo Blox Builder快速上手指南
  • MoeMemosAndroid:开源灵感捕捉神器,让你的想法永不丢失
  • Unity AI聊天工具包:零基础快速集成智能对话系统
  • Auto PY to EXE终极指南:3分钟快速上手Python打包利器
  • 系统维护必备工具详解:Driver Store Explorer操作指南
  • 零基础掌握工业通信接口奇偶校验配置流程
  • iCloud Photos Downloader网络连接故障全解析:从断线到完美下载的实战指南
  • 2025年比较好的起动柜/高压电容补偿起动柜新厂实力推荐(更新) - 行业平台推荐
  • NX实时控制任务调度策略:全面讲解与实例分析
  • 网易云音乐无损解析工具完整教程:打造专属高品质音乐库
  • 23、编程中的列表与重复块应用
  • 快速解决Rufus无法下载Windows ISO的5个实用技巧
  • 5分钟搞定!Minecraft世界转换神器Chunker全方位指南
  • 8、《Ladybug Chase 游戏开发教程:上》
  • 高效USB启动盘制作神器:Rufus让系统安装更简单
  • PaddlePaddle Docker镜像使用完全手册
  • 全面讲解电路板PCB设计基础知识与工具选择
  • 58、编程技术综合解析
  • 通俗解释AUTOSAR软件开发与传统嵌入式差异
  • Sequential Thinking MCP Server:构建结构化思维的技术实践