在 Elasticsearch 中使用 Amazon Nova 模型

news2025/7/17 0:23:12

作者:来自 Elastic Andre Luiz

了解如何在 Elasticsearch 中使用 Amazon Nova 系列模型。

在本文中,我们将讨论 Amazon 的 AI 模型家族——Amazon Nova,并学习如何将其与 Elasticsearch 结合使用。

关于 Amazon Nova

Amazon Nova 是 Amazon 的一系列人工智能模型,可在 Amazon Bedrock 上使用,旨在提供高性能和成本效益。这些模型支持文本、图像和视频输入,生成文本输出,并针对不同的准确性、速度和成本需求进行了优化。

Amazon Nova 主要模型

  • Amazon Nova Micro:专注于文本处理的快速、经济高效模型,适用于翻译、推理、代码补全和数学问题求解。其生成速度超过 200 个 token 每秒,非常适合需要即时响应的应用。

  • Amazon Nova Lite:一种低成本的多模态模型,可快速处理图像、视频和文本。其速度和准确性表现突出,适用于交互式和高数据量的应用,尤其是成本敏感的场景。

  • Amazon Nova Pro:最高级的选择,结合了高准确性、速度和成本效益。适用于视频摘要、问答、软件开发和 AI 代理等复杂任务。专家评测表明,它在文本和视觉理解方面表现卓越,并且能够遵循指令执行自动化工作流。

Amazon Nova 模型适用于多种应用场景,包括内容创作、数据分析、软件开发以及基于 AI 的流程自动化。

我们将展示如何将 Amazon Nova 模型与 Elasticsearch 结合使用,以实现自动化的产品评论分析。

我们将进行以下步骤:
  1. 通过 Inference API 创建一个端点,将 Amazon Bedrock 与 Elasticsearch 集成。

  2. 使用 Inference Processor 创建一个数据处理管道,该管道将调用 Inference API 端点。

  3. 索引产品评论,并使用管道自动生成评论分析。

  4. 分析集成后的结果。

在 Inference API 中创建端点

首先,我们配置 Inference API 以将 Amazon Bedrock 与 Elasticsearch 集成。我们选择 Amazon Nova Lite 作为使用的模型,其 ID 为 amazon.nova-lite-v1:0,因为它在速度、准确性和成本之间提供了良好的平衡。

注意:你需要有效的凭据才能使用 Amazon Bedrock。你可以在此处查看文档以获取访问密钥:

PUT _inference/completion/bedrock_completion_amazon_nova-lite
{
   "service": "amazonbedrock",
   "service_settings": {
       "access_key": "#access_key#",
       "secret_key": "#secret_key#",
       "region": "us-east-1",
       "provider": "amazontitan",
       "model": "amazon.nova-lite-v1:0"
   }
}

创建评论分析 pipeline

现在,我们创建一个处理流水线,该流水线将使用 Inference Processor 来执行评论分析提示(prompt)。该提示会将评论数据发送到 Amazon Nova Lite,并执行以下操作:

  • 情感分类(正面、负面或中立)

  • 评论摘要生成

  • 关键词提取

  • 真实性评估(真实 | 可疑 | 泛化)

PUT /_ingest/pipeline/review_analyzer_ai
{
      "processors": [
      {
        "script": 
            {
            "source": """ctx.prompt = "Analyze the following product review and return a structured JSON. Task: - Summarize the review concisely. - Detect and classify the sentiment as positive, neutral, or negative.- Generate relevant tags (keywords) based on the review content and detected sentiment. - Evaluate the authenticity of the review (authentic, suspicious, or generic). Review: " + ctx.review + " Respond in JSON format with the following fields: \"review_analyze\": {\"sentiment\": \"<positive | neutral | negative>\", \"authenticity\": \"<authentic | suspicious | generic>\",\"summary\": \"<short review summary>\", \"keywords\": [\"<keyword 1>\", \"<keyword 2>\", \"...\"]}}}"
            """
            }
      },
      {
        "inference": {
          "model_id": "bedrock_completion_amazon_nova-lite",
          "input_output": {
            "input_field": "prompt",
            "output_field": "result"
          }
        }
      },
      {
        "gsub": {
          "field": "result",
          "pattern": "```json",
          "replacement": ""
        } 
      },
      {
        "json" : {
          "field" : "result",
          "strict_json_parsing": false,
          "add_to_root" : true
        }
      },
      {
        "remove": {
          "field": "result"
        }
      },
      {
        "remove": {
          "field": "prompt"
        }
      }
    ]
}

索引评论

现在,我们使用 Bulk API 索引产品评论。之前创建的流水线将自动应用,并将 Nova 模型生成的分析结果添加到索引的文档中。

POST bulk/
{ "index": { "_index" : "products", "_id": 1, "pipeline":"review_analyzer_ai" } }
{ "product": "Pampers Pants Premium Care Fralda", "review": "Best diaper ever! Great material, lots of cotton, without all that plastic. Doesn't leak! My baby is a boy and every diaper leaked around the waist, this model solved the problem. Even on a small baby it's worth the effort of putting on the short diaper. I put it on my baby at 9 pm and only take it off in the morning, without any leaks." }
{ "index": { "_index" : "products", "_id": 2, "pipeline":"review_analyzer_ai" } }
{ "product": "Portable Electric Body Massager", "review": "It broke in three months for no apparent reason, thank goodness I didn't review it before. I don't recommend buying it because it has a short lifespan." }
{ "index": { "_index" : "products", "_id": 3, "pipeline":"review_analyzer_ai" } }
{ "product": "Havit Fuxi-H3 Black Quad-Mode Wired and Wireless Gaming Headset", "review": "The sound is good for the price, but the connectivity is horrible. You always need to be playing audio, otherwise it loses connection (I work from home, and this is very annoying). Sometimes it loses connection and you have to turn it off and on again to get it back on. The microphone is very sensitive, so it loses connection frequently and you have to turn the headset off and on for the microphone to work again. The flexibility of the stem is useless, because if you move it, the microphone can turn off. Sometimes I need to use Linux and the headset simply doesn't work. It's light and comfortable, the sound is adequate, but the connectivity is terrible." }
{ "index": { "_index" : "products", "_id": 4, "pipeline":"review_analyzer_ai" } }
{ "product": "Air Fryer 4L Oil Free Fryer Mondial", "review": "For those looking for value for money, it's a good option, but the tray (which is underneath the perforated basket) is already peeling a lot. My mother has one just like it and said that hers is even rusting, in other words, the material is MUCH inferior. There's also something that bothers me, because it looks like a microwave, it doesn't fry evenly, it's weaker in the middle and stronger on the sides. Buy at your own risk." }

查询和分析结果

最后,我们运行查询以查看 Amazon Nova Lite 模型如何分析和分类评论。通过执行 GET products/_search,我们可以获取已经被评论内容增强的文档。

该模型能够识别主要情感(正面、中立或负面),生成简要摘要,提取相关关键词,并评估每条评论的 真实性。这些字段有助于理解客户的意见,而无需阅读完整文本。

在解释结果时,我们关注以下方面:

  • 情感:指示消费者对产品的整体感受。

  • 摘要:提炼评论中提及的主要观点。

  • 关键词:可用于分组相似评论或识别反馈模式。

  • 真实性:判断评论是否可信,对内容审核或筛选有帮助。

   "hits": [
      {
        "_index": "products",
        "_id": "1",
        "_score": 1,
        "_ignored": [
          "review.keyword"
        ],
        "_source": {
          "product": "Pampers Pants Premium Care Fralda",
          "model_id": "bedrock_completion_amazon_nova-lite",
          "review_analyze": {
            "summary": "The reviewer praises the diaper for its great material, high cotton content, and leak-proof design, especially highlighting its effectiveness for their baby.",
            "sentiment": "positive",
            "keywords": [
              "best diaper",
              "great material",
              "cotton",
              "no plastic",
              "leak-proof",
              "baby",
              "effective"
            ],
            "authenticity": "authentic"
          },
          "review": "Best diaper ever! Great material, lots of cotton, without all that plastic. Doesn't leak! My baby is a boy and every diaper leaked around the waist, this model solved the problem. Even on a small baby it's worth the effort of putting on the short diaper. I put it on my baby at 9 pm and only take it off in the morning, without any leaks."
        }
      },
      {
        "_index": "products",
        "_id": "2",
        "_score": 1,
        "_source": {
          "product": "Portable Electric Body Massager",
          "model_id": "bedrock_completion_amazon_nova-lite",
          "review_analyze": {
            "summary": "The product broke in three months for no apparent reason and the reviewer does not recommend it due to its short lifespan.",
            "sentiment": "negative",
            "keywords": [
              "broke",
              "short lifespan",
              "not recommend"
            ],
            "authenticity": "authentic"
          },
          "review": "It broke in three months for no apparent reason, thank goodness I didn't review it before. I don't recommend buying it because it has a short lifespan."
        }
      },
      {
        "_index": "products",
        "_id": "3",
        "_score": 1,
        "_ignored": [
          "review.keyword"
        ],
        "_source": {
          "product": "Havit Fuxi-H3 Black Quad-Mode Wired and Wireless Gaming Headset",
          "model_id": "bedrock_completion_amazon_nova-lite",
          "review_analyze": {
            "summary": "The headset has good sound quality for the price but suffers from poor connectivity, especially when using the microphone or moving the headset. It also has compatibility issues with Linux.",
            "sentiment": "negative",
            "keywords": [
              "sound",
              "connectivity",
              "microphone",
              "compatibility",
              "annoying",
              "turn off and on",
              "Linux",
              "flexible stem",
              "work from home"
            ],
            "authenticity": "authentic"
          },
          "review": "The sound is good for the price, but the connectivity is horrible. You always need to be playing audio, otherwise it loses connection (I work from home, and this is very annoying). Sometimes it loses connection and you have to turn it off and on again to get it back on. The microphone is very sensitive, so it loses connection frequently and you have to turn the headset off and on for the microphone to work again. The flexibility of the stem is useless, because if you move it, the microphone can turn off. Sometimes I need to use Linux and the headset simply doesn't work. It's light and comfortable, the sound is adequate, but the connectivity is terrible."
        }
      },
      {
        "_index": "products",
        "_id": "4",
        "_score": 1,
        "_ignored": [
          "review.keyword"
        ],
        "_source": {
          "product": "Air Fryer 4L Oil Free Fryer Mondial",
          "model_id": "bedrock_completion_amazon_nova-lite",
          "review_analyze": {
            "summary": "The product offers value for money but has issues with peeling, rusting, and uneven frying.",
            "sentiment": "negative",
            "keywords": [
              "value for money",
              "peeling",
              "rusting",
              "uneven frying",
              "weaker in the middle"
            ],
            "authenticity": "authentic"
          },
          "review": "For those looking for value for money, it's a good option, but the tray (which is underneath the perforated basket) is already peeling a lot. My mother has one just like it and said that hers is even rusting, in other words, the material is MUCH inferior. There's also something that bothers me, because it looks like a microwave, it doesn't fry evenly, it's weaker in the middle and stronger on the sides. Buy at your own risk."
        }
      }
    ]

最终想法

Amazon Nova LiteElasticsearch 的集成展示了语言模型如何将原始评论转化为结构化且有价值的信息。通过流水线处理评论,我们能够自动且一致地提取 情感、真实性、摘要关键词

结果表明,该模型能够理解评论的上下文、分类用户的意见,并突出显示每个体验中最相关的点。这使数据集更加丰富,可用于提升搜索能力。

想要获得 Elastic 认证?查看下一次 Elasticsearch Engineer 培训时间!

Elasticsearch 拥有众多新功能,可帮助你构建最佳搜索解决方案。探索我们的示例 notebooks 了解更多信息,开启 免费云试用,或立即在本地机器尝试 Elastic

原文:https://www.elastic.co/search-labs/blog/amazon-nova-models-elasticsearch

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2330090.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

sql server数据库可疑修复

sql server数据库可疑修复 从上图可以看到数据库nchrdb显示可疑&#xff0c;导致原因为NC系统在增加公共薪资项目的时候&#xff0c;扩展字段报错了&#xff0c;第一次遇到这种情况&#xff0c;折腾了很久终于解决&#xff0c;记下解决方案&#xff1a; 1&#xff0c;将SQL数据…

【项目管理-高项】学习方法 整体概览

相关文档&#xff0c;希望互相学习&#xff0c;共同进步 风123456789&#xff5e;-CSDN博客 1.背景 &#x1f4dd; 软考高项,全称 信息系统项目管理师 ,是软考高级资格项目之一。 本考试考三门科目&#xff1a;综合知识&#xff08;上午&#xff09;、案例分析&#xff08;下午…

【Linux网络与网络编程】05.应用层自定义协议序列化和反序列化

前言 本篇博客通过网络计算器的实现来帮助各位理解应用层自定义协议以及序列化和反序列化。 一、认识自定义协议&&序列化和反序列化 我们程序员写的一个个解决我们实际问题&#xff0c;满足我们日常需求的网络程序都是在应用层。前面我们说到&#xff1a;协议是一种…

Flutter之页面布局二

目录&#xff1a; 1、列表布局1.1、基础列表1.2、水平滑动的列表1.3、网格列表1.3、不同列表项的列表1.4、包含间隔的列表1.6、长列表 2、滚动2.1、浮动的顶栏2.2、平衡错位滚动 1、列表布局 1.1、基础列表 import package:flutter/material.dart;void main() > runApp(con…

RCE漏洞的小点总结

RCE简介与危害&#xff1a;包括远程代码执行和远程命令执行漏洞。 在很多web应用中&#xff0c;开发人员会使用一些函数&#xff0c;这些函数以一些字符串作为输入&#xff0c;功能是将输入的字符串当作代码或者命令来进行执行。当用户可以控制这些函数的输入时&#xff0c;就…

单片机实现多线程的方法汇总

在单片机上实现“多线程”的方法有几种&#xff0c;下面按照从简单到复杂、从轻量到系统性来列出常见的方案&#xff1a; &#x1f9f5; 一、伪多线程&#xff08;最轻量&#xff09; 方法&#xff1a;主循环 状态机 / 定时器轮询 主循环中轮流调用各个任务的处理函数&#x…

Java八股文-List集合

集合的底层是否加锁也就代表是否线程安全 (一)List集合 一、数组 array[1]是如何通过索引找到堆内存中对应的这块数据的呢? (1)数组如何获取其他元素的地址值 (2)为什么数组的索引是从0开始的&#xff0c;不可以从1开始吗 (3)操作数组的时间复杂度 ①查找 根据索引查询 未…

从零构建大语言模型全栈开发指南:第四部分:工程实践与部署-4.2.3行业案例:智能客服中的图文交互系统

👉 点击关注不迷路 👉 点击关注不迷路 👉 点击关注不迷路 文章大纲 从零构建大语言模型全栈开发指南-第四部分:工程实践与部署4.2.3 行业案例:智能客服中的图文交互系统1. 图文交互系统的核心挑战与价值2. 系统架构设计2.1 分层架构2.2 Adapter技术应用3. 行业应用案例…

华为IP(4)

VRRP&#xff08;虚拟路由冗余协议&#xff09; 前言&#xff1a; 局域网中的用户终端通常采用配置一个默认网关的形式访问外部网络&#xff0c;如果默认网关设备发生故障&#xff0c;那么所有用户终端访问外部网络的流量将会中断。可以通过部署多个网关的方式来解决单点故障…

计算机网络中科大 - 第1章 结构化笔记(详细解析)

博主主页 目录 **1. 计算机网络概述****1.1 计算机网络的定义****1.2 计算机网络的发展** **2. 计算机网络的组成与分类****2.1 计算机网络的组成****2.2 计算机网络的分类****按地理范围****按拓扑结构****按交换方式** **3. 计算机网络的性能指标****4. 计算机网络体系结构**…

【神经网络】python实现神经网络(三)——正向学习的模拟演练

有了之前的经验(【神经网络】python实现神经网络(二)——正向推理的模拟演练),我们继续来介绍如何正向训练神经网络中的超参(包含权重以及偏置),本章大致的流程图如下: 一.损失函数 神经网络以某个指标为基准寻求最优权重参数,而这个指标即可称之为 “损失函数” 。(…

PPTAgent:一款开源免费生成和评估幻灯片的项目

这篇文章介绍一下PPTAgent&#xff0c;一个从文档自动生成演示文稿的创新系统。该系统从人类的展示创作方法中汲取灵感&#xff0c;采用两步流程来确保卓越的整体质量。此外&#xff0c;本文还介绍了PPTEval&#xff0c;这是一个综合评估框架&#xff0c;可以跨多个维度评估演示…

Java 大视界 -- Java 大数据在智能供应链库存优化与成本控制中的应用策略(172)

&#x1f496;亲爱的朋友们&#xff0c;热烈欢迎来到 青云交的博客&#xff01;能与诸位在此相逢&#xff0c;我倍感荣幸。在这飞速更迭的时代&#xff0c;我们都渴望一方心灵净土&#xff0c;而 我的博客 正是这样温暖的所在。这里为你呈上趣味与实用兼具的知识&#xff0c;也…

斯坦福大学李飞飞团队新突破!FlowMo 革新图像 Tokenizer

当我们悠然刷着手机&#xff0c;看到一张可爱猫咪的照片时&#xff0c;大脑会瞬间识别出「这是一只猫」&#xff0c;这一切不过是电光火石间的事儿。但在计算机的 “眼中”&#xff0c;情况却复杂得超乎想象。假设这是一张10001000像素的彩色照片&#xff0c;在计算机的世界里&…

博客文章:深入分析 PyMovie - 基于 Python和 MoviePy 的视频管理工具

这是一个使用 wxPython 构建界面、moviepy 处理视频的自定义 GUI 应用程序。该工具提供了视频播放、元数据提取、格式转换、视频裁剪和截图等功能。通过分析其设计和实现&#xff0c;我们将了解其工作原理、优点和潜在的改进空间。 C:\pythoncode\new\output\pymovieSample.py …

2025年渗透测试面试题总结-某 携程旅游-基础安全工程师(题目+回答)

网络安全领域各种资源&#xff0c;学习文档&#xff0c;以及工具分享、前沿信息分享、POC、EXP分享。不定期分享各种好玩的项目及好用的工具&#xff0c;欢迎关注。 目录 携程旅游-基础安全工程师 反序列化原理 核心原理 扩展分析 SQL注入本质 核心原理 扩展分析 SQL注…

niuhe插件, 在 go 中渲染网页内容

思路 niuhe 插件生成的 go 代码是基于 github.com/ma-guo/niuhe 库进行组织管理的, niuhe 库 是对 go gin 库的一个封装&#xff0c;因此要显示网页, 可通过给 gin.Engine 指定 HTMLRender 来实现。 实现 HTMLRender 我们使用 gitee.com/cnmade/pongo2gin 实现 1. main.go …

使用MySQL时出现 Ignoring query to other database 错误

Ignoring query to other database 错误 当在远程连接软件中输入MySQL命令出现该错误 导致错误原因是&#xff1a;登录mysql时账户名没有加上u 如果出现该错误&#xff0c;退出mysql&#xff0c;重新输入正确格式进入即可&#xff01;

java后端开发day34--脑子空空如何无痛想起所有知识点--概念拟人化

1.上半部学习思考 1.1反思–浮躁–二倍速 刚开始算半个小白吧&#xff0c;从最基础的知识点开始学习&#xff0c;到后面学习整个项目的布局和功能。可能是后面慢慢懂得多了&#xff0c;每次打代码搞项目啊什么的&#xff0c;就能明显感觉到自己很浮躁&#xff1a;脑子里已经明…

fastGPT—前端开发获取api密钥调用机器人对话接口(HTML实现)

官网文档链接&#xff1a;OpenAPI 介绍 | FastGPT 首先按照文档说明创建api密钥 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-sca…