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

2.ElasticSearch-Java API

一、基础使用

1.1 Maven 坐标

    <dependencies><dependency><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId><version>7.8.0</version></dependency><!--es的客户端--><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.8.0</version></dependency><dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-api</artifactId><version>2.13.3</version></dependency><dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId><version>2.13.3</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.14.1</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.10</version><scope>test</scope></dependency></dependencies>

1.2 创建客户端对象

    public static void main(String[] args) throws IOException {//创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));//关闭连接client.close();}

1.3 索引

1.3.1 创建索引

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));//创建索引CreateIndexRequest request = new CreateIndexRequest("user2");CreateIndexResponse createIndexResponse = client.indices().create(request, RequestOptions.DEFAULT);//第二个是默认的一个请求配置boolean acknowledged = createIndexResponse.isAcknowledged();if (acknowledged) {System.out.println("响应成功");}//关闭连接client.close();

1.3.2 查询索引

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));GetIndexRequest request = new GetIndexRequest("user");GetIndexResponse getIndexResponse = client.indices().get(request, RequestOptions.DEFAULT);System.out.println(getIndexResponse.getAliases() );System.out.println(getIndexResponse.getMappings());System.out.println(getIndexResponse.getSettings());//关闭连接client.close();

结果如下所示:
在这里插入图片描述

1.3.3 删除索引

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));DeleteIndexRequest request = new DeleteIndexRequest("user");AcknowledgedResponse response = client.indices().delete(request, RequestOptions.DEFAULT);System.out.println(response.isAcknowledged());//关闭连接client.close();

1.4 文档

1.4.1 新增

       //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));//索引IndexRequest request = new IndexRequest();request.index("user").id("1001");User user = new User();user.setName("zhangsan");user.setAge("30");user.setSex("男");//向ES插入数据,必须将数据转换成JSONObjectMapper mapper = new ObjectMapper();request.source(mapper.writeValueAsString(user), XContentType.JSON);//插入数据IndexResponse response = client.index(request, RequestOptions.DEFAULT);System.out.println( response.getResult());// 返回值为 CREATED/UPDATED//关闭连接client.close();

1.4.2 修改

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));//索引UpdateRequest request = new UpdateRequest();request.index("user").id("1001");request.doc(XContentType.JSON, "sex","女");//局部修改//插入数据UpdateResponse response = client.update(request, RequestOptions.DEFAULT);System.out.println(response.getResult());// 返回值为 CREATED/UPDATED//关闭连接client.close();

1.4.3 查询

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));GetRequest request = new GetRequest();request.index("user").id("1001");GetResponse response = client.get(request, RequestOptions.DEFAULT);System.out.println(response.getIndex());System.out.println(response.getSourceAsString());//关闭连接client.close();

在这里插入图片描述

1.4.4 删除

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));DeleteRequest request = new DeleteRequest();request.index("user").id("1001");DeleteResponse response = client.delete(request, RequestOptions.DEFAULT);System.out.println(response.toString());//关闭连接client.close();

在这里插入图片描述

1.4.5 批量新增

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));//批量添加数据BulkRequest request = new BulkRequest();request.add(new IndexRequest().index("user").id("1001").source(XContentType.JSON, "name", "张三"));request.add(new IndexRequest().index("user").id("1002").source(XContentType.JSON, "name", "李四"));request.add(new IndexRequest().index("user").id("1003").source(XContentType.JSON, "name", "王五"));BulkResponse response = client.bulk(request, RequestOptions.DEFAULT);System.out.println(response.getTook());//花费了多长时间System.out.println(Arrays.toString(response.getItems()));//多个响应//关闭连接client.close();

1.4.6 批量删除

        //创建客户端对象RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", 9200, "http")));BulkRequest request = new BulkRequest();request.add(new DeleteRequest().index("user").id("1001"));request.add(new DeleteRequest().index("user").id("1002"));request.add(new DeleteRequest().index("user").id("1003"));BulkResponse response = client.bulk(request, RequestOptions.DEFAULT);System.out.println(response.getTook());//花费了多长时间System.out.println(Arrays.toString(response.getItems()));//多个响应//关闭连接client.close();

1.4.7 高级查询

1.4.7.1 查询所有索引数据
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
// 查询所有数据
sourceBuilder.query(QueryBuilders.matchAllQuery());
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.2 term 查询,查询条件为关键字
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.termQuery("age", "30"));
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.3 分页查询
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.matchAllQuery());
// 分页查询
// 当前页其实索引(第一条数据的顺序号),from
sourceBuilder.from(0);
// 每页显示多少条 size
sourceBuilder.size(2);
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.4 数据排序
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.matchAllQuery());
// 排序
sourceBuilder.sort("age", SortOrder.ASC);
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits()
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.5 过滤字段
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.matchAllQuery());
//查询字段过滤
String[] excludes = {};
String[] includes = {"name", "age"};
sourceBuilder.fetchSource(includes, excludes);
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.6 Bool 查询
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
// 必须包含
boolQueryBuilder.must(QueryBuilders.matchQuery("age", "30"));
// 一定不含
boolQueryBuilder.mustNot(QueryBuilders.matchQuery("name", "zhangsan"));
// 可能包含
boolQueryBuilder.should(QueryBuilders.matchQuery("sex", "男"));
sourceBuilder.query(boolQueryBuilder);
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.6 范围查询
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
RangeQueryBuilder rangeQuery = QueryBuilders.rangeQuery("age");
// 大于等于
rangeQuery.gte("30");
// 小于等于
rangeQuery.lte("40");
sourceBuilder.query(rangeQuery);
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.7 模糊查询
// 创建搜索请求对象
SearchRequest request = new SearchRequest();
request.indices("student");
// 构建查询的请求体
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.query(QueryBuilders.fuzzyQuery("name","zhangsan").fuzziness(Fu
zziness.ONE));
request.source(sourceBuilder);
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
// 查询匹配
SearchHits hits = response.getHits();
System.out.println("took:" + response.getTook());
System.out.println("timeout:" + response.isTimedOut());
System.out.println("total:" + hits.getTotalHits());
System.out.println("MaxScore:" + hits.getMaxScore());
System.out.println("hits========>>");
for (SearchHit hit : hits) {
//输出每条查询的结果信息
System.out.println(hit.getSourceAsString());
}
System.out.println("<<========");
1.4.7.8 高亮查询
// 高亮查询
SearchRequest request = new SearchRequest().indices("student");
//2.创建查询请求体构建器
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
//构建查询方式:高亮查询
TermsQueryBuilder termsQueryBuilder = 
QueryBuilders.termsQuery("name","zhangsan");
//设置查询方式
sourceBuilder.query(termsQueryBuilder);
//构建高亮字段
HighlightBuilder highlightBuilder = new HighlightBuilder();
highlightBuilder.preTags("<font color='red'>");//设置标签前缀
highlightBuilder.postTags("</font>");//设置标签后缀
highlightBuilder.field("name");//设置高亮字段
//设置高亮构建对象
sourceBuilder.highlighter(highlightBuilder);
//设置请求体
request.source(sourceBuilder);
//3.客户端发送请求,获取响应对象
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
//4.打印响应结果
SearchHits hits = response.getHits();
System.out.println("took::"+response.getTook());
System.out.println("time_out::"+response.isTimedOut());
System.out.println("total::"+hits.getTotalHits());
System.out.println("max_score::"+hits.getMaxScore());
System.out.println("hits::::>>");
for (SearchHit hit : hits) {
String sourceAsString = hit.getSourceAsString();
System.out.println(sourceAsString);
//打印高亮结果
Map<String, HighlightField> highlightFields = hit.getHighlightFields();
System.out.println(highlightFields);
}
System.out.println("<<::::");
1.4.7.9 聚合查询
  • 最大年龄
// 高亮查询
SearchRequest request = new SearchRequest().indices("student");
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.aggregation(AggregationBuilders.max("maxAge").field("age"));
//设置请求体
request.source(sourceBuilder);
//3.客户端发送请求,获取响应对象
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
//4.打印响应结果
SearchHits hits = response.getHits();
System.out.println(response);
  • 分组统计
// 高亮查询
SearchRequest request = new SearchRequest().indices("student");
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
sourceBuilder.aggregation(AggregationBuilders.terms("age_groupby").field("ag
e"));
//设置请求体
request.source(sourceBuilder);
//3.客户端发送请求,获取响应对象
SearchResponse response = client.search(request, RequestOptions.DEFAULT);
//4.打印响应结果
SearchHits hits = response.getHits();
System.out.println(response);

相关文章:

2.ElasticSearch-Java API

一、基础使用 1.1 Maven 坐标 <dependencies><dependency><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId><version>7.8.0</version></dependency><!--es的客户端--><dependenc…...

蓝桥杯-小明的彩灯(差分)

问题描述&#xff1a; 差分数组 1. 什么是差分数组&#xff1f; 差分数组 c 是原数组 a 的“差值表示”&#xff0c;其定义如下&#xff1a; c[0] a[0]c[i] a[i] - a[i-1] &#xff08;i ≥ 1&#xff09; 差分数组记录了相邻元素的差值。例如&#xff0c;原数组 a [1, …...

vim定位有问题的脚本/插件的一般方法

在使用vim的过程中可能会遇到一些报错或其他不符合预期的情况&#xff0c;本文介绍一些我自己常用的定位有问题脚本/插件的方法&#xff08;以下方法同样适用于neovim&#xff09; 执行了某些命令的情况 这种情况最简单&#xff0c;使用:h 命令&#xff0c;如果插件有文档的话…...

EasyExcel实现图片导出功能(记录)

背景&#xff1a;在旧系统的基础上&#xff0c;导出一些工单信息时&#xff0c;现需要新添加处理人的签名或者签章&#xff0c;这就涉及图片的上传、下载、写入等几个操作。 1、EasyExcel工具类 &#xff08;1&#xff09;支持下拉框的导出。 import com.alibaba.excel.Easy…...

PCL拟合空间3D圆周 fit3DCircle

PCL版本 1.15.0 main.cpp #include<vector> #include<iostream> #include <array> #include <string> #include <windows.h> #include <omp.h> #include <charconv> // C17 #include <cstdlib> #include<chrono> #in…...

ansible 实现达梦7数据库初始化数据脚本写入

关于使用ansible 对ARM版达梦7的k8s自动化部署参考我的这篇操作 ansible-playbook 写arm版达梦7数据库的一键安装脚本-CSDN博客文章浏览阅读303次&#xff0c;点赞5次&#xff0c;收藏3次。达梦官方提供镜像目前是dm8_x86 版本&#xff0c;因为众所周知的国产化方面的需求&…...

leetcode每日刷题

Day18 Title45.jump(跳跃游戏 II) 解法一&#xff1a;动态规划 依然分三步走&#xff1a; 1.状态方程 2.dp[i]的意义 3.边界条件及初始值 优先思考第二个问题&#xff1a; dp[i]表示到达i时需要的最少跳数 第一个问题&#xff1a; dp[ij]min(dp[i]1,dp[ij]) 为什么&am…...

Ubuntu安装Nginx

Ubuntu安装Nginx 由于 Ubuntu 的 apt 命令内置了 nginx 源&#xff0c;因此不用配置 apt 就可以直接下载安装&#xff1a; apt install nginx -y查看 nginx 是否启动&#xff1a; ps -ef |grep nginx如果没有启动则需要手动启动&#xff1a; nginx1. 配置Nginx 使用浏览器…...

Hadoop的序列化

&#xff08;一&#xff09;什么是序列化与反序列化 序列化就是把内存中的对象&#xff0c;转换成字节序列&#xff08;或其他数据传输协议&#xff09;以便于存储到磁盘&#xff08;持久化&#xff09;和网络传输。 反序列化就是将收到字节序列&#xff08;或其他数据传输协议…...

拼多多商品详情接口爬虫实战指南

一、引言 在电商运营和数据分析中&#xff0c;获取商品详情数据是至关重要的一步。拼多多作为国内知名的社交电商平台&#xff0c;提供了丰富的商品详情接口&#xff0c;允许开发者通过API获取商品的详细信息。本文将详细介绍如何通过爬虫技术结合拼多多商品详情接口&#xff…...

python网络爬虫

一、Python爬虫核心库 HTTP请求库 requests&#xff1a;简单易用的HTTP请求库&#xff0c;处理GET/POST请求。aiohttp&#xff1a;异步HTTP客户端&#xff0c;适合高并发场景。 HTML/XML解析库 BeautifulSoup&#xff1a;基于DOM树的解析库&#xff0c;支持多种解析器&#xf…...

java线程安全-单例模式-线程通信

首先看看单例模式的写法 首先我们先来回顾一下饿汉式单例模式&#xff1a; class Singleton{private static Singleton singletonnew Singleton();private Singleton(){}public static Singleton getInstrance(){return singleton;} } public class Test{public static void …...

ASP.NET中将 PasswordHasher 使用的 PBKDF2 算法替换为更现代的 Scrypt 或 Argon2 算法

相关博文&#xff1a; .Net实现SCrypt Hash加密_scrypt加密-CSDN博客 密钥派生算法介绍 及 PBKDF2(过时)&#xff1c;Bcrypt(开始淘汰)&#xff1c;Scrypt&#xff1c; Argon2(含Argon2d、Argon2i、Argon2id)简介-CSDN博客 浅述.Net中的Hash算法&#xff08;顺带对称、非对称…...

力扣刷题-热题100题-第34题(c++、python)

23. 合并 K 个升序链表 - 力扣&#xff08;LeetCode&#xff09;https://leetcode.cn/problems/merge-k-sorted-lists/?envTypestudy-plan-v2&envIdtop-100-liked 顺序合并 合并两个有序链表作为子函数&#xff0c;创建一个空链表&#xff0c;然后对含有多个链表的数组进…...

【SpringCloud】从入门到精通【上】

今天主播我把黑马新版微服务课程MQ高级之前的内容都看完了&#xff0c;虽然在看视频的时候也记了笔记&#xff0c;但是看完之后还是忘得差不多了&#xff0c;所以打算写一篇博客再温习一下内容。 课程坐标:黑马程序员SpringCloud微服务开发与实战 微服务 认识单体架构 单体架…...

如何给路由器配置代理IP?更改网络ip地址时出现错误怎么解决?

在现代网络环境中&#xff0c;无论是家庭用户还是企业用户&#xff0c;经常需要配置路由器以实现网络访问的灵活性和匿名性。其中&#xff0c;给路由器配置代理IP是一个常见的需求&#xff0c;尤其是在需要绕过地域限制、增强网络安全或进行匿名浏览时。然而&#xff0c;配置过…...

程序化广告行业(70/89):ABTester系统助力落地页优化实践

程序化广告行业&#xff08;70/89&#xff09;&#xff1a;ABTester系统助力落地页优化实践 在程序化广告领域摸爬滚打多年&#xff0c;深知持续学习和知识共享的重要性。写这篇博客&#xff0c;就是希望能和大家一起深入探索程序化广告行业&#xff0c;共同学习、共同进步。今…...

远程监控系统项目里练习

1、项目目标 设备端&#xff1a; &#xff08;1&#xff09;基于stm32mp157开发板&#xff0c;裁剪linux5.10.10&#xff0c;完成ov5640摄像头移植&#xff1b; &#xff08;2&#xff09;完成用户层程序&#xff0c;完成对摄像头的控制及与云端服务的数据交互。 云端&…...

Spring Boot 通过全局配置去除字符串类型参数的前后空格

1、问题 避免前端输入的字符串参数两端包含空格&#xff0c;通过统一处理的方式&#xff0c;trim掉空格 2、实现方式 /*** 去除字符串类型参数的前后空格* author yanlei* since 2022-06-14*/ Configuration AutoConfigureAfter(WebMvcAutoConfiguration.class) public clas…...

设计模式 --- 观察者模式

设计模式 --- 观察者模式 什么是观察者模式观察者模式典型应用 --- C#中的事件使用观察者模式实现事件处理机制 什么是观察者模式 观察者模式&#xff08;Observer Pattern&#xff09;是一种行为型设计模式&#xff0c;用于在对象之间建立一对多的依赖关系。当一个对象&#x…...

组播网络构建:IGMP、PIM 原理及应用实践

IP组播基础 组播基本架构 组播IP地址 一个组播IP地址并不是表示具体的某台主机&#xff0c;而是一组主机的集合&#xff0c;主机声明加入某组播组即标识自己需要接收目的地址为该组播地址的数据IP组播常见模型分为ASM模型和SSM模型ASM&#xff1a;成员接收任意源组播数据&…...

Java常见的23种设计模式

Java常见的23种设计模式 大家好&#xff0c;我是钢板兽&#xff01; 本文将系统梳理 Java 的设计模式&#xff0c;涵盖创建型、结构型和行为型三大类&#xff0c;结合定义、原理、优点、应用场景、示例代码&#xff0c;帮助你初步了解常见的23种设计模式。 一、设计模式分类…...

兔单B细胞单抗制备服务

1.兔单B细胞技术原理 兔单B细胞技术是近年来新发展的一类快速制备单克隆抗体的技术&#xff0c;是一种通过分离和单克隆化兔子体内的B细胞来制备单一来源的高特异性抗体的方法。基于流式细胞分选技术进行单B细胞单抗制备&#xff0c;利用每个B细胞只含有一个功能性重链可变区D…...

MySQL基础 [六] - 内置函数+复合查询+表的内连和外连

内置函数一般要用select调用 内置函数 日期函数 current_date函数 current_date函数用于获取当前的日期。如下&#xff1a; current_time函数 current_time函数用于获取当前的时间。如下&#xff1a; now函数 now函数用于获取当前的日期时间。如下&#xff1a; date函数 dat…...

nginx路径匹配的优先级

在 Nginx 配置中&#xff0c;当请求 /portal/agent/sse 时&#xff0c;会匹配 location ~* /sse$ 规则&#xff0c;而不是 location /portal。原因如下&#xff1a; 匹配规则解析 location ~* /sse$ ~* 表示 不区分大小写的正则匹配/sse$ 表示以 /sse 结尾的路径匹配结果&#…...

tcp/ip攻击及防范

作为高防工程师&#xff0c;我每天拦截数以万计的恶意流量&#xff0c;其中TCP/IP协议层攻击是最隐蔽、最具破坏性的威胁之一。常见的攻击手法包括&#xff1a; 1. SYN Flood攻击&#xff1a;攻击者发送大量伪造的SYN包&#xff0c;耗尽服务器连接资源&#xff0c;导致正常用…...

2025年3月中国电子学会青少年软件编程(Python)等级考试试卷(一级)答案 + 解析

更多真题在线练习系统&#xff1a;历年真题在线练习系统 一、单选题 1、下列哪个软件不能运行 Python 程序&#xff1f;&#xff08; &#xff09; A、JupyterNotebook B、Pycharm C、原版的Scratch D、IDLE 正确答案&#xff1a;C 答案解析&#xff1a;本题考察的 Pyt…...

TreeMap 核心知识点与面试题解析

TreeMap 核心知识点与面试题解析 一、TreeMap 基础概念 TreeMap 是 Java 集合框架中基于 红黑树&#xff08;Red-Black Tree&#xff09; 实现的 Map&#xff0c;具有以下特点&#xff1a; 有序性&#xff1a;默认按 key 的自然顺序&#xff08;Comparable&#xff09;或自定…...

深入理解 DevOps 与 CI/CD:概念、流程及优势

在当今快速发展的数字化时代,软件开发和交付的速度与质量成为企业在激烈竞争中脱颖而出的关键因素。DevOps 和 CI/CD 作为现代软件开发领域的重要理念和实践,正深刻地改变着软件开发生命周期的运作方式。本文将深入探讨 DevOps 的概念,详细解析 CI/CD 的内涵、管道阶段以及实…...

Flutter BloC 架构入门指南

BLoC (Business Logic Component) 是 Flutter 中一种流行的状态管理架构&#xff0c;它可以帮助你将业务逻辑与 UI 分离&#xff0c;使代码更清晰、可测试性更强。 核心概念 1. BloC 的核心组件 Events&#xff1a;用户交互或系统事件&#xff08;如按钮点击、网络请求完成&…...

OpenHarmony-AI调研

OpenHarmony-AI调研 文章目录 OpenHarmony-AI调研前言一、当前版本部署组件二、AI架构1.mindspore-lite2.ai_engine3.neural_network_runtime4.intelligent_voice_framework5.HDI驱动 三、应用1.命令行以及web运行deepseek-r12.与deepseek通过语音进行交互3.物品识别4.人脸识别…...

zk基础—zk实现分布式功能

1.zk实现数据发布订阅 (1)发布订阅系统一般有推模式和拉模式 推模式&#xff1a;服务端主动将更新的数据发送给所有订阅的客户端。 拉模式&#xff1a;客户端主动发起请求来获取最新数据(定时轮询拉取)。 (2)zk采用了推拉相结合来实现发布订阅 首先客户端需要向服务端注册自己关…...

Tips:用proxy解决前后端分离项目中的跨域问题

在前后端分离项目中&#xff0c;"跨域问题"是浏览器基于同源策略&#xff08;Same-Origin Policy&#xff09;对跨域请求的安全限制。当你的前端&#xff08;如运行在 http://localhost:3000 &#xff09;和后端&#xff08;如运行在 http://localhost:8080 &#…...

JMeterPlugins-Standard-1.4.0 插件详解:安装、功能与使用指南

JMeterPlugins-Standard-1.4.0 是 Apache JMeter&#xff08;一款流行的开源负载和性能测试工具&#xff09;的插件包&#xff0c;它扩展了 JMeter 的功能&#xff0c;提供了更多监听器&#xff08;Listeners&#xff09;、采样器&#xff08;Samplers&#xff09;和辅助组件&a…...

JMeter 中,Token 和 Cookie 的区别及实际应用

在 JMeter 中,Token 和 Cookie 都是用于处理用户会话和身份验证的机制,但它们的 工作原理、存储方式 和 应用场景 有显著区别。以下是详细对比和实际应用指南: 1. 核心区别 特性Token (如 JWT、OAuth)Cookie存储位置通常存储在 HTTP 请求头(如 Authorization: Bearer <t…...

蓝桥杯真题——好数、R格式

目录 蓝桥杯2024年第十五届省赛真题-好数 【模拟题】 题目描述 输入格式 输出格式 样例输入 样例输出 提示 代码1&#xff1a;有两个案例过不了&#xff0c;超时 蓝桥杯2024年第十五届省赛真题-R 格式 【vector容器的使用】 题目描述 输入格式 输出格式 样例输入…...

JavaScript惰性加载优化实例

这是之前的一位朋友的酒桌之谈&#xff0c;他之前负责的一个电商项目&#xff0c;刚刚开发万&#xff0c;首页加载时间特别长&#xff0c;体验很差&#xff0c;所以就开始排查&#xff0c;发现是在首页一次性加载所有js导致的问题&#xff0c;这个问题在自己学习的时候并不明显…...

0_Pytorch中的张量操作

[引言]张量的概念 1.基本概念 张量是一个通用的多维数组&#xff0c;可以表示标量&#xff08;0 维&#xff09;、向量&#xff08;1 维&#xff09;、矩阵&#xff08;2 维&#xff09;以及更高维度的数据。张量是 PyTorch 中的核心数据结构&#xff0c;用于表示和操作数据。…...

Java面试43-常见的限流算法有哪些?

限流算法是一种系统保护策略&#xff0c;主要是避免在流量高峰导致系统被压垮&#xff0c;造成系统不可用的问题。 常见的限流算法有五种&#xff1a; 计数器限流&#xff0c;一般用在单一维度的访问频率限制上&#xff0c;比如短信验证码每隔60s只能发送一次&#xff0c;或者…...

牛客网:树的高度 ← 根节点为 0 号节点

【题目来源】 https://www.nowcoder.com/questionTerminal/4faa2d4849fa4627aa6d32a2e50b5b25 【题目描述】 现在有一棵合法的二叉树&#xff0c;树的节点都是用数字表示&#xff0c;现在给定这棵树上所有的父子关系&#xff0c;求这棵树的高度。 【输入格式】 输入的第一行表…...

Linux:进程程序替换execl

目录 引言 1.单进程版程序替换 2.程序替换原理 3.6种替换函数介绍 3.1 函数返回值 3.2 命名理解 3.3 环境变量参数 引言 用fork创建子进程后执行的是和父进程相同的程序(但有可能执行不同的代码分支)&#xff0c;我们所创建的所有的子进程&#xff0c;执行的代码&#x…...

⑩数据中心M-LAG 实战

一、配置指导自己去看今天操作的是M-LAG 基础实验 二、配置代码信息回顾 ### 1、配置 M-LAG 系统 MAC 地址<H3C>system-view[H3C]m-lag system-mac ?H-H-H MAC address2a7a-53ee-0100 Bridge MAC address[H3C]m-lag system-mac### 2、配置 M-LAG 系统编号…...

delphi idtcpserver 搭建tcp ,ssl协议服务端

如果想用indy idtcpserver实现tcp ssl,那么正是你需要的 首先生成证书: 2、windows生成pem证书 - 站着说话不腰疼 - 博客园 有证书后 idtcpserver 用的三个证书, IdServerIOHandlerSSLOpenSSL1.SSLOptions.CertFile = ca.crt IdServerIOHandlerSSLOpenSSL1.SSLOptions.…...

如何实现外观模式?

一、模式理解&#xff08;用快递驿站比喻&#xff09; 想象你网购了5件商品&#xff0c;分别来自不同快递公司。 外观模式就像小区门口的快递驿站&#xff0c;你不需要知道中通怎么分拣、顺丰怎么运输&#xff0c;只要到驿站报取件码就能拿到所有包裹。 在前端开发中&#xf…...

深入解析 Linux 文件系统权限:从基础到高级实践

引言 在 Linux 系统中&#xff0c;文件系统权限是保障数据安全和多用户协作的核心机制。想象这样一个场景&#xff1a; 你的服务器上有多个团队共享项目文件 财务数据必须严格保密&#xff0c;仅允许指定人员访问 开发团队需要共同编辑代码&#xff0c;但禁止随意删除他人文…...

GZ036区块链卷一 EtherStore合约漏洞详解

题目 pragma solidity >0.8.3;contract EtherStore {mapping(address > uint) public balances;function deposit() public payable {balances[msg.sender] msg.value;emit Balance(balances[msg.sender]);}function withdraw() public {uint bal balances[msg.sender…...

医药流通行业批发公司IT运维转型:Prometheus+Grafana监控Spring Boot 3应用实践

一、引言&#xff1a;医药流通行业IT运维挑战与工具换代需求 在医药流通行业批发领域&#xff0c;业务的核心在于供应链的高效运转、订单处理的精准及时以及库存管理的动态平衡。随着互联网医疗的兴起和电商平台的渗透&#xff0c;传统医药批发企业正加速向数字化、智能化转型…...

编程助手fitten code使用说明(超详细)(vscode)

这两年 AI 发展迅猛&#xff0c;作为开发人员&#xff0c;我们总是追求更快、更高效的工作方式&#xff0c;AI 的出现可以说改变了很多人的编程方式。 AI 对我们来说就是一个可靠的编程助手&#xff0c;给我们提供了实时的建议和解决方&#xff0c;无论是快速修复错误、提升代…...

金融大模型

FinGPT 数据集&#xff1a;https://github.com/AI4Finance-Foundation/FinGPT/tree/master/fingpt/FinGPT-v3 FinGPT v3 系列是在新闻和微博情绪分析数据集上使用 LoRA 方法进行微调的LLM&#xff0c;在大多数金融情绪分析数据集上取得了最佳分数。 FinGPT v3.1 使用 chatgl…...

【Pandas】pandas DataFrame infer_objects

Pandas2.2 DataFrame Conversion 方法描述DataFrame.astype(dtype[, copy, errors])用于将 DataFrame 中的数据转换为指定的数据类型DataFrame.convert_dtypes([infer_objects, …])用于将 DataFrame 中的数据类型转换为更合适的类型DataFrame.infer_objects([copy])用于尝试…...