elastic search java api 向量搜索实践 / java结合es实现 以图搜图

这篇具有很好参考价值的文章主要介绍了elastic search java api 向量搜索实践 / java结合es实现 以图搜图。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

准备数据

elastic search java api 向量搜索实践 / java结合es实现 以图搜图,elasticsearch,springboot,java,elasticsearch,机器学习

1. FunctionScoreQueryBuilder 方式

代码

//构建脚本查询
Script script = new Script(
        Script.DEFAULT_SCRIPT_TYPE,
        "painless",
        //pic_vector - 搜索字段
        "cosineSimilarity(params.queryVector, doc['pic_vector']) + 1.0",
        new HashMap<String, Object>() {{
            //searchData.getPicVector() - 需要搜索的向量数组,List<Double> 类型
            put("queryVector", searchData.getPicVector());
        }});
ScriptScoreFunctionBuilder scriptScoreFunctionBuilder = ScoreFunctionBuilders.scriptFunction(script);

//构建普通查询
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
// 只查存在的数据
boolQueryBuilder.filter(QueryBuilders.termQuery(FieldGetterUtil.getPropName(searchData::getState), ConstantEnum.ONE.code));
// 查询名称
if (StringUtils.isNotBlank(searchData.getName())) {
    boolQueryBuilder.filter(QueryBuilders.termQuery(FieldGetterUtil.getPropName(searchData::getName), searchData.getName()));
}

// 构建查询请求
SearchRequest searchRequest = new SearchRequest("picture");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(boolQueryBuilder, scriptScoreFunctionBuilder);
searchSourceBuilder.query(functionScoreQueryBuilder);
searchRequest.source(searchSourceBuilder);

// 执行搜索
SearchResponse searchResponse = null;
try {
    searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
} catch (IOException e) {
    e.printStackTrace();
}

DSL

GET picture/_search
{
  "query": {
    "function_score": {
      "query": {
        "bool": {
          "filter": [
            {
              "term": {
                "state": {
                  "value": 1,
                  "boost": 1
                }
              }
            }
          ],
          "adjust_pure_negative": true,
          "boost": 1
        }
      },
      "functions": [
        {
          "filter": {
            "match_all": {
              "boost": 1
            }
          },
          "script_score": {
            "script": {
              "source": "cosineSimilarity(params.queryVector, doc['pic_vector']) + 1.0",
              "lang": "painless",
              "params": {
                "queryVector": [
                  数据太长了,先不展示了~
                ]
              }
            }
          }
        }
      ],
      "score_mode": "multiply",
      "max_boost": 3.4028235e+38,
      "boost": 1
    }
  }
}

搜索图片

elastic search java api 向量搜索实践 / java结合es实现 以图搜图,elasticsearch,springboot,java,elasticsearch,机器学习

搜索结果

elastic search java api 向量搜索实践 / java结合es实现 以图搜图,elasticsearch,springboot,java,elasticsearch,机器学习文章来源地址https://www.toymoban.com/news/detail-745546.html

2. WrapperQueryBuilder 方式

代码

BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
searchRequest.source().query(boolQueryBuilder);

// 只查存在的数据
boolQueryBuilder.filter(QueryBuilders.termQuery(FieldGetterUtil.getPropName(searchData::getState), ConstantEnum.ONE.code));

// 查询拖名称
if (StringUtils.isNotBlank(searchData.getName())) {
    boolQueryBuilder.filter(QueryBuilders.termQuery(FieldGetterUtil.getPropName(searchData::getName), searchData.getName()));
}

/*
    若包含图片向量,使用 WrapperQueryBuilder 重新构建搜索 DSL 。
    这个方法要在所有条件设置完成之后调用
 */
List<Double> picVector = searchData.getPicVector();
if (CollectionUtil.isNotEmpty(picVector)) {
    buildPicVectorWrapperQueryBuilder(searchData, searchRequest);
}
//执行检索
SearchResponse searchResponse = null;
try {
    searchResponse = restHighLevelClient.search(searchRequest, RequestOptions.DEFAULT);
} catch (IOException e) {
    e.printStackTrace();
    return ElasticSearchUtil.getEmptyList();
}

/**
 * 构建向量搜索DSL
 *
 * @param searchData
 * @param searchRequest
 */
private void buildPicVectorWrapperQueryBuilder(PictureSearchParam searchData, SearchRequest searchRequest) {
    SearchSourceBuilder source = searchRequest.source();
    source.minScore(searchData.getMinCosScore());
    JSONObject boolQueryDsl = JSONObject.parseObject(source.toString()).getJSONObject("query");
    String fieldName = MapUtils.camelToUnderline(FieldGetterUtil.getPropName(searchData::getPicVector));
    JSONObject queryObject = new JSONObject();
    queryObject.
            put("script_score", new JSONObject() {{
                put("query", boolQueryDsl);
                put("script", new JSONObject() {{
                    put("source", "cosineSimilarity(params." + fieldName + ", doc['" + fieldName + "'])+1.0");
                    put("params", new JSONObject() {{
                        put(fieldName, searchData.getPicVector());
                    }});
                }});
            }});
    WrapperQueryBuilder wrapperQueryBuilder = new WrapperQueryBuilder(JSON.toJSONString(queryObject));
    searchRequest.source().query(wrapperQueryBuilder);
}

DSL

GET picture/_search
{
  "from": 0,
  "size": 10,
  "query": {
    "wrapper": {
      "query": "eyJzY3JpcHRfc2NvcmUiOnsicXVlcnkiOnsiYm9vbCI6eyJmaWx0ZXIiOlt7InRlcm0iOnsic3RhdGUiOnsidmFsdWUiOjEsImJvb3N0IjoxLjB9fX1dLCJhZGp1c3RfcHVyZV9uZWdhdGl2ZSI6dHJ1ZSwiYm9vc3QiOjEuMH19LCJzY3JpcHQiOnsic291cmNlIjoiY29zaW5lU2ltaWxhcml0eShwYXJhbXMucGljX3ZlY3RvciwgZG9jWydwaWNfdmVjdG9yJ10pKzEuMCIsInBhcmFtcyI6eyJwaWNfdmVjdG9yIjpbMS42NDQyMDUyMTI1OTMwNzg2LDEuODg2NTg2NDI3Njg4NTk4NiwxLjc1MjA5NTQ2MDg5MTcyMzYsMS40Njg4NTIxNjIzNjExNDUsMC41MjE1MjQzNjk3MTY2NDQzLDAuNzE2MjgzMDgyOTYyMDM2MSwwLjI0NTcxNzY0NDY5MTQ2NzI5LDEuNDE2MTI3NDQzMzEzNTk4NiwwLjY2NDY2NDc0NTMzMDgxMDUsMS4zNDkwNDg4NTI5MjA1MzIyLDAuNDgxMTQwMjg1NzMwMzYxOTQsMC4yMzc5MjgzNDU3OTk0NDYxLDEuMjQ2OTg5NjA3ODEwOTc0MSwwLjA4NjYyNDk2NTA3MTY3ODE2LDAuNTkyMjI3Mzk5MzQ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ODgsMC4wODI1OTk1NzI4MzczNTI3NSwwLjA2NDU4NTEwNDU4NDY5MzkxLDAuNzE1OTU4MzU2ODU3Mjk5OCwwLjA4NjE3NTQ3MTU0NDI2NTc1LDAuODI0OTM1MTM4MjI1NTU1NCwwLjUyNzY3ODE5MTY2MTgzNDcsMC4yMTM1OTM4NTU1MDAyMjEyNSwxLjY1NTkwMTU1MTI0NjY0MywyLjM2NzQ3MDI2NDQzNDgxNDUsMC4yNTAxNDkyNzk4MzI4Mzk5NywwLjU5ODY5ODE5ODc5NTMxODYsMC45NDc0MjIyMDY0MDE4MjUsMC4xNTMxMDAwODgyMzg3MTYxMywwLjAwOTE2NDcxNzk3OTcyOTE3Nl19fX19"
    }
  },
  "min_score": 1,
  "explain": true,
  "_source": {
    "includes": [
      "id",
      "pic_path"
    ],
    "excludes": []
  },
  "sort": [
    {
      "create_time": {
        "order": "desc"
      }
    }
  ],
  "track_total_hits": 2147483647
}

搜索图片

elastic search java api 向量搜索实践 / java结合es实现 以图搜图,elasticsearch,springboot,java,elasticsearch,机器学习

搜索结果

elastic search java api 向量搜索实践 / java结合es实现 以图搜图,elasticsearch,springboot,java,elasticsearch,机器学习

看到最后了一起薅个羊毛呗~

到了这里,关于elastic search java api 向量搜索实践 / java结合es实现 以图搜图的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Spring Boot 整合 分布式搜索引擎 Elastic Search 实现 数据聚合

    本文参考黑马 分布式Elastic search Elasticsearch是一款非常强大的开源搜索引擎,具备非常多强大功能,可以帮助我们从海量数据中快速找到需要的内容 本篇文章将讲解 Elastic Search 如何实现数据聚合,以及 在项目实战中如何通过数据聚合实现业务需求并完成功能。 以下为官方

    2024年02月11日
    浏览(43)
  • Spring Boot 整合 分布式搜索引擎 Elastic Search 实现 我附近的、酒店竞排

    本文参考黑马 分布式Elastic search Elasticsearch是一款非常强大的开源搜索引擎,具备非常多强大功能,可以帮助我们从海量数据中快速找到需要的内容 在酒店列表页的右侧,有一个小地图,点击地图的定位按钮,地图会找到你所在的位置: 点击定位后,会发送给服务端以下请求

    2024年02月06日
    浏览(38)
  • ES搜索引擎入门+最佳实践(九):项目实战(二)--elasticsearch java api 进行数据增删改查

            本篇是这个系列的最后一篇了,在这之前可以先看看前面的内容: ES搜索引擎入门+最佳实践(一)_flame.liu的博客-CSDN博客 ES搜索引擎入门+最佳实践(二)_flame.liu的博客-CSDN博客 ES搜索引擎入门+最佳实践(三)_flame.liu的博客-CSDN博客 ES搜索引擎入门+最佳实践(四)_flame.liu的博客

    2024年02月12日
    浏览(55)
  • 【搜索引擎】elastic search核心概念

    前言 本文不涉及ES的具体安装下载、操作、集群的内容,这部分内容会放在后面一篇文章中。本文只包含ES的核心理论,看完本文再去学ES的细节会事半功倍。 目录 1.由日志存储引出的问题 2.什么是ES? 3.ES的数据结构 4.ES的核心原理 5.联系作者 本文或者说本系列的来源: 前面

    2024年02月03日
    浏览(46)
  • fastapi结合Manticore Search、elasticsearch、mysql实现全文搜索

    创建测试表 测试表插入数据 表字段描述 字段意义 mysql数据同步到es es查看数据(Elasticvue插件)   mysql数据同步到Manticore 注:Manticore 和 Mysql 使用pymysql即mysql客户端 Manticore 数据查询(工具Webyog SQLyog)   es安全认证连接(参考官网) 按fields查询方法封装,输入参数fields 筛选器,

    2024年02月12日
    浏览(41)
  • elastic search es 分组统计 aggs 次数用法

    参考链接:https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations.html es 各个版本的语法可能会不一样,如果大家在用的时候发现语法报错了,请查阅相关版本的语法。 刚需要按 ip 地址统计某个接口的访问次数,查了下 es 分组统计次数 aggs 的用法,特此记录一下,方

    2024年02月11日
    浏览(57)
  • 使用docker安装elastic search[ES]和kibana

    使用docker安装elastic search和kibana,版本均为7.17.1 docker pull# 去dockerhub看具体版本,这里用7.17.1 临时安装生成文件# 参数说明 -d 后台启动 –name 起别名即:NAMES -p 9200:9200 将端口映射出来 elasticsearch的9200端口是供外部访问使用;9300端口是供内部访问使用集群间通讯 -e “discovery.

    2024年02月14日
    浏览(45)
  • 微服务 分布式搜索引擎 Elastic Search RestAPI

    本文参考黑马 分布式Elastic search Elasticsearch是一款非常强大的开源搜索引擎,具备非常多强大功能,可以帮助我们从海量数据中快速找到需要的内容 ES官方提供了各种不同语言的客户端,用来操作ES。这些客户端的本质就是组装DSL语句,通过http请求发送给ES。官方文档地址:

    2024年01月24日
    浏览(47)
  • 微服务分布式搜索引擎 Elastic Search RestClient 操作文档

    本文参考黑马 分布式Elastic search Elasticsearch是一款非常强大的开源搜索引擎,具备非常多强大功能,可以帮助我们从海量数据中快速找到需要的内容 初始化RestHighLevelClient 为了与索引库操作分离,我们再次参加一个测试类,做两件事情: 初始化RestHighLevelClient 我们的酒店数据

    2024年01月24日
    浏览(38)
  • 【elastic search】JAVA操作elastic search

    目录 1.环境准备 2.ES JAVA API 3.Spring Boot操作ES 本文是作者ES系列的第三篇文章,关于ES的核心概念移步: https://bugman.blog.csdn.net/article/details/135342256?spm=1001.2014.3001.5502 关于ES的下载安装教程以及基本使用,移步: https://bugman.blog.csdn.net/article/details/135342256?spm=1001.2014.3001.5502 在前文

    2024年01月25日
    浏览(47)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包