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

ElasticSearch的客户端操作

ElasticSearch的客户端操作

1、客户端介绍

官方文档地址: https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html 
实际开发中,有多种方式操作Elasticsearch:
客户端工具:发送http请求(RESTful风格)操作:9200端口
使用Postman发送请求直接操作
使用ElasticSearch-head-master图形化界面插件操作
使用Elastic官方数据可视化的平台Kibana进行操作【推荐】
Java代码操作:9300端口
Elasticsearch提供的Java API 客户端进行操作
Spring Data ElasticSearch 持久层框架进行操作
官网支持的客户端访问方式:
https://www.elastic.co/guide/en/elasticsearch/client/index.html

在这里插入图片描述

2、索引库操作

使用Kibana进行以下实验,进行Restful接口访问
索引库操作,完成对索引的增、删、查操作

1. 创建索引库(index)

发送请求:
# 在kibana中,不用写地址和端口,/shopping是简化写法,真实请求地址是:http://127.0.0.1:9200/shopping
# 请求方法:PUT
PUT /shopping
响应结果:
#! Deprecation: the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template
{"acknowledged" : true,"shards_acknowledged" : true,"index" : "shopping"
}

“acknowledged” : true, 代表操作成功
“shards_acknowledged” : true, 代表分片操作成功
“index” : “shopping” 表示创建的索引库名称
注意:创建索引库的分片数默认5片,在7.0.0之后的ElasticSearch版本中,默认1片;

重复添加:报错,已经存在
在这里插入图片描述

2. 查看所有索引(index)

发送请求:

# 请求方法:GET
GET /_cat/indices?v

响应结果:
在这里插入图片描述

表头的含义(查看帮助信息:GET /_cat/indices?help)
health 当前服务器健康状态:
green(集群完整) yellow(单点正常、集群不完整) red(单点不正常)
status 索引打开、关闭状态
index 索引名
uuid 索引统一编号
pri 主分片数量
rep 副分片数量
docs.count 可用文档数量
docs.deleted 文档删除状态(逻辑删除,段合并时被清理)
store.size 主分片和副分片整体占空间大小
pri.store.size 主分片占空间大小

3. 查看某个索引(index)

发送请求:

# 请求方法:GET
GET /shopping
响应结果:
{"shopping" : {"aliases" : { },"mappings" : { },"settings" : {"index" : {"creation_date" : "1586587411462","number_of_shards" : "5","number_of_replicas" : "1","uuid" : "VCl1hHsJQDe2p2dn46o0NA","version" : {"created" : "6080199"},"provided_name" : "shopping"}}}
}
内容解释:
{"shopping【索引库名】" : {"aliases【别名】" : { },"mappings【映射】" : { },"settings"【索引库设置】 : {"index【索引】" : {"creation_date【创建时间】" : "1586587411462","number_of_shards【索引库分片数】" : "5","number_of_replicas【索引库副本数】" : "1","uuid【唯一标识】" : "VCl1hHsJQDe2p2dn46o0NA","version【版本】" : {"created" : "6080199"},"provided_name【索引库名称】" : "shopping"}}}
}

4. 删除索引(index)

发送请求:

# 请求方法:DELETE
DELETE /shopping
响应结果:
{"acknowledged" : true
}

3、类型及映射操作

类型(type)及(mapping)操作

1. 创建类型映射

有了索引库,等于有了数据库中的database。
接下来就需要建索引库(index)中的类型(type)了,类似于数据库(database)中的表(table)。创建数据库表需要设置字段名称,类型,长度,约束等;索引库也一样,在创建索引库的类型时,需要知道这个类型下有哪些字段,每个字段有哪些约束信息,这就叫做映射(mapping)。
给shopping这个索引库添加了一个名为product的类型,并且在类型中设置了4个字段:
title:商品标题
subtitle: 商品子标题
images:商品图片
price:商品价格

发送请求:
# 请求方法:PUT
PUT /shopping/product/_mapping
{"properties": {"title":{"type": "text","analyzer": "ik_max_word"},"subtitle":{"type": "text","analyzer": "ik_max_word"},"images":{"type": "keyword","index": false},"price":{"type": "float","index": true}}
}	PUT /索引库名/_mapping/类型名称 或 索引库名/类型名称/_mapping
{"properties": {"字段名称":{"type【类型】": "类型","index【是否索引】": true,"store【是否存储】": false,"analyzer【分词器】": "具体分词器"}...}
}响应结果:
#! Deprecation: [types removal] Specifying types in put mapping requests is deprecated. To be compatible with 7.0, the mapping definition should not be nested under the type name, and the parameter include_type_name must be provided and set to false.
{"acknowledged" : true
}

说明:
#! 弃用:[类型删除]不建议在放置映射请求中指定类型。 为了与7.0兼容,映射定义不应嵌套在类型名称下,并且必须提供参数include_type_name并将其设置为false。

类型名称:就是前面将的type的概念,类似于数据库中的表 
字段名:任意填写,下面指定许多属性,例如:title、subtitle、images、price

type:类型,Elasticsearch中支持的数据类型非常丰富,说几个关键的:
①String类型,又分两种:
text:可分词
keyword:不可分词,数据会作为完整字段进行匹配
②Numerical:数值类型,分两类
基本数据类型:long、interger、short、byte、double、float、half_float
浮点数的高精度类型:scaled_float
③Date:日期类型
④Array:数组类型
⑤Object:对象
index:是否索引,默认为true,也就是说你不进行任何配置,所有字段都会被索引。
true:字段会被索引,则可以用来进行搜索
false:字段不会被索引,不能用来搜索
store:是否将数据进行独立存储,默认为false
原始的文本会存储在_source里面,默认情况下其他提取出来的字段都不是独立存储的,是从_source里面提取出来的。当然你也可以独立的存储某个字段,只要设置"store": true即可,获取独立存储的字段要比从_source中解析快得多,但是也会占用更多的空间,所以要根据实际业务需求来设置。
analyzer:分词器,这里的ik_max_word即使用ik分词器

2. 查看类型映射

发送请求:
# 请求方法:GET
GET /shopping/product/_mapping
响应结果:
{"shopping" : {"mappings" : {"product" : {"properties" : {"images" : {"type" : "keyword","index" : false},"price" : {"type" : "float"},"subtitle" : {"type" : "text","analyzer" : "ik_max_word"},"title" : {"type" : "text","analyzer" : "ik_max_word"}}}}}
}
3.	创建索引库同时进行映射配置(常用)
发送请求:
# 请求方法:PUT
PUT /shopping2
{"settings": {},"mappings": {"product":{"properties": {"title":{"type": "text","analyzer": "ik_max_word"},"subtitle":{"type": "text","analyzer": "ik_max_word"},"images":{"type": "keyword","index": false},"price":{"type": "float","index": true}}}}
}
响应结果:
{"acknowledged" : true,"shards_acknowledged" : true,"index" : "shopping2"
}

4、【文档操作】【基本CURD操作】

1. 新建文档

发送请求:
# 请求方法:POST
POST /shopping/product
{"title":"小米手机","images":"http://www.gulixueyuan.com/xm.jpg","price":3999.00
}
响应结果:
{"_index" : "shopping","_type" : "product","_id" : "indGaHEB1ahbZ0SRrXt3","_version" : 1,"result" : "created","_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_seq_no" : 0,"_primary_term" : 1
}
响应结果解释:
{"_index【索引库】" : "shopping","_type【类型】" : "product","_id【主键id】" : "indGaHEB1ahbZ0SRrXt3","_version【版本】" : 1,"result【操作结果】" : "created","_shards【分片】" : {"total【总数】" : 2,"successful【成功】" : 1,"failed【失败】" : 0},"_seq_no" : 0,"_primary_term" : 1
}

可以看到结果显示为:created,是创建成功了。
另外,需要注意的是,在响应结果中有个_id字段,这个就是这条文档数据的唯一标识,以后的增删改查都依赖这个id作为唯一标示。可以看到id的值为:indGaHEB1ahbZ0SRrXt3,这里我们新增时没有指定id,所以是ES帮我们随机生成的id。
多创建几条数据:

POST /shopping/product/2
{"title":"华为手机","images":"http://www.gulixueyuan.com/hw.jpg","price":4999.00
}POST /shopping/product/3
{"title":"小米电视","images":"http://www.gulixueyuan.com/xmds.jpg","price":5999.00
}

2. 查看文档

发送请求:
# 请求方法:GET
GET /shopping/product/indGaHEB1ahbZ0SRrXt3
响应结果:
{"_index" : "shopping","_type" : "product","_id" : "indGaHEB1ahbZ0SRrXt3","_version" : 1,"_seq_no" : 0,"_primary_term" : 1,"found" : true,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}
}
响应结果解释:
{"_index【索引库】" : "shopping","_type【类型】" : "product","_id【主键id】" : "indGaHEB1ahbZ0SRrXt3","_version【版本】" : 1,"_seq_no" : 0,"_primary_term" : 1,"found【查询结果】" : true,"_source【源文档信息】" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}
}

• _source:源文档信息,所有的数据都在里面。
• _id:这条文档的唯一标示
• found:查询结果,返回true代表查到,false代表没有

3. 自定义id新建文档

发送请求:
# 请求方法:POST
POST /shopping/product/1
{"title":"小米手机","images":"http://www.gulixueyuan.com/xm.jpg","price":3999.00
}
响应结果:
{"_index" : "shopping","_type" : "product","_id" : "1","_version" : 1,"result" : "created","_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_seq_no" : 1,"_primary_term" : 1
}

• 主键id变为指定的id

4. 修改文档(覆盖方式)

请求url不变,请求体变化,会将原有数据内容覆盖。

发送请求:
# 请求方法:POST
POST /shopping/product/1
{"title":"华为手机","images":"http://www.gulixueyuan.com/hw.jpg","price":4999.00
}
响应结果:
{"_index" : "shopping","_type" : "product","_id" : "1","_version" : 2,"result" : "updated","_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_seq_no" : 2,"_primary_term" : 1
}

可以看到result结果是:updated,使用GET /shopping/product/1查询,发现数据被更新。

5. 根据id修改某一个字段

发送请求:
# 请求方法:POST
POST /shopping/product/1/_update
{ "doc": {"price":3000.00} 
}
响应结果:
{"_index" : "shopping","_type" : "product","_id" : "1","_version" : 2,"result" : "updated","_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_seq_no" : 8,"_primary_term" : 1
}

可以看到result结果是:updated,使用GET /shopping/product/1查询,发现数据被更新。

6. 删除一条文档

删除一个文档不会立即从磁盘上移除,它只是被标记成已删除(逻辑删除)。
Elasticsearch会在段合并时(磁盘碎片整理)进行删除内容的清理。
发送请求:

# 请求方法:DELETE
DELETE /shopping/product/1
响应结果:
{"_index" : "shopping","_type" : "product","_id" : "1","_version" : 3,"result" : "deleted","_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_seq_no" : 3,"_primary_term" : 1
}

可以看到result结果是:deleted,数据被删除。如果删除不存在的文档,result:not_found
例如:

DELETE /shopping/product/11主键不存在
{"_index" : "shopping","_type" : "product","_id" : "11","_version" : 1,"result" : "not_found","_shards" : {"total" : 2,"successful" : 1,"failed" : 0},"_seq_no" : 0,"_primary_term" : 1
}

7. 根据条件删除文档

发送请求:
# 请求方法:DELETE
POST /shopping/_delete_by_query
{"query":{"match":{"title":"手机"}}
}
响应结果:
{"took" : 33,"timed_out" : false,"total" : 2,"deleted" : 2,"batches" : 1,"version_conflicts" : 0,"noops" : 0,"retries" : {"bulk" : 0,"search" : 0},"throttled_millis" : 0,"requests_per_second" : -1.0,"throttled_until_millis" : 0,"failures" : [ ]
}
响应结果解释:
{"took【耗时】" : 33,"timed_out【是否超时】" : false,"total【总数】" : 2,"deleted【删除总数】" : 2,"batches" : 1,"version_conflicts" : 0,"noops" : 0,"retries" : {"bulk" : 0,"search" : 0},"throttled_millis" : 0,"requests_per_second" : -1.0,"throttled_until_millis" : 0,"failures" : [ ]
}

5、【请求体查询】【基本查询】

1. 请求体查询
Elasticsearch基于JSON提供完整的查询DSL来定义查询。
DSL(Domain Specific Language):领域特定语言
在这里插入图片描述

2. 基础数据

POST /shopping/product/1
{"title":"小米手机","images":"http://www.gulixueyuan.com/xm.jpg","price":3999.00
}POST /shopping/product/2
{"title":"华为手机","images":"http://www.gulixueyuan.com/hw.jpg","price":4999.00
}POST /shopping/product/3
{"title":"小米电视","images":"http://www.gulixueyuan.com/xmds.jpg","price":5999.00
}

3. 基本查询

1) 查询所有(match_all)

发送请求:
# 请求方法:GET
#请求地址:http://127.0.0.1:9200/索引库名/_search
GET /shopping/_search
{"query": {"match_all": {}}
}
请求解释:
GET  /{索引库}/_search
{"query":{"查询类型":{"查询条件":"查询条件值"}}
}
"query":这里的query代表一个查询对象,里面可以有不同的查询属性
"查询类型":例如:match_all(代表查询所有), match,term , range 等等
"查询条件":查询条件会根据类型的不同,写法也有差异
响应结果:
{"took" : 1,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 3,"max_score" : 1.0,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "2","_score" : 1.0,"_source" : {"title" : "华为手机","images" : "http://www.gulixueyuan.com/hw.jpg","price" : 4999.0}},{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 1.0,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 1.0,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0}}]}
}
响应结果解释:
{"took【查询花费时间,单位毫秒】" : 1,"timed_out【是否超时】" : false,"_shards【分片信息】" : {"total【总数】" : 5,"successful【成功】" : 5,"skipped【忽略】" : 0,"failed【失败】" : 0},"hits【搜索命中结果】" : {"total【命中总数】" : 3,"max_score【所有查询结果中,文档的最高得分】" : 1.0,"hits【命中结果集合】" : [{"_index" : "shopping","_type" : "product","_id" : "2","_score" : 1.0,"_source" : {"title" : "华为手机","images" : "http://www.gulixueyuan.com/hw.jpg","price" : 4999.0}},。。。}]}
}

2) 匹配查询(match)
match类型查询,会把查询条件进行分词,然后进行查询,多个词条之间是or的关系

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"match": {"title": "小米手机"}}
}
响应结果:
{"took" : 2,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 3,"max_score" : 0.5753642,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 0.5753642,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}},{"_index" : "shopping","_type" : "product","_id" : "2","_score" : 0.2876821,"_source" : {"title" : "华为手机","images" : "http://www.gulixueyuan.com/hw.jpg","price" : 4999.0}},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 0.2876821,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0}}]}
}

在上面的案例中,不仅会查询到电视,而且与小米相关的都会查询到。
某些情况下,我们需要更精确查找,我们希望这个关系变成and,可以这样做:
发送请求:
本例中,只有同时包含小米和手机的词条才会被搜索到。

GET /shopping/_search
{"query": {"match": {"title": {"query": "小米手机","operator": "and"}}}
}
响应结果:
{"took" : 11,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 1,"max_score" : 0.5753642,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 0.5753642,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}}]}
}

3) 多字段匹配查询(multi_match)
multi_match与match类似,不同的是它可以在多个字段中查询。

发送请求:
# 请求方法:GET
#fields属性:设置查询的多个字段名称
GET /shopping/_search
{"query": {"multi_match": {"query": "小米","fields": ["title","subtitle"]}}
}
响应结果:
{"took" : 1,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 2,"max_score" : 0.2876821,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 0.2876821,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 0.2876821,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0}}]}
}

4) 关键词精确查询(term)
term查询,精确的关键词匹配查询,不对查询条件进行分词。

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"term": {"title": {"value": "小米"}}}
}
响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 2,"max_score" : 0.2876821,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 0.2876821,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 0.2876821,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0}}]}
}

5) 多关键词精确查询(terms)
terms 查询和 term 查询一样,但它允许你指定多值进行匹配。
如果这个字段包含了指定值中的任何一个值,那么这个文档满足条件,类似于mysql的in

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"terms": {"price": [3999,5999]}}
}
响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 2,"max_score" : 1.0,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 1.0,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 1.0,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0}}]}
}

6、【请求体查询】【结果过滤】

1. 指定查询字段
默认情况下,ElasticSearch在搜索的结果中,会把文档中保存在_source的所有字段都返回。
如果我们只想获取其中的部分字段,我们可以添加_source的过滤

发送请求:
# 请求方法:GET
GET /shopping/_search
{"_source": ["title","price"],  "query": {"terms": {"price": [3999]}}
}
响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 1,"max_score" : 1.0,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 1.0,"_source" : {"price" : 3999.0,"title" : "小米手机"}}]}
}

2. 过滤指定字段:includes和excludes
我们也可以通过:
 includes:来指定想要显示的字段
 excludes:来指定不想要显示的字段
二者都是可选的。

发送请求:
# 请求方法:GET
GET /shopping/_search
{"_source": {"includes": ["title","price"]},  "query": {"terms": {"price": [3999]}}
}GET /shopping/_search
{"_source": {"excludes": ["images"]},  "query": {"terms": {"price": [3999]}}
}
响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 1,"max_score" : 1.0,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 1.0,"_source" : {"price" : 3999.0,"title" : "小米手机"}}]}
}

7、【请求体查询】【高级查询】

1. 布尔组合(bool)
bool把各种其它查询通过must(必须 )、must_not(必须不)、should(应该)的方式进行组合

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"bool": {"must": [{"match": {"title": "小米"}}],"must_not": [{"match": {"title": "电视"}}],"should": [{"match": {"title": "手机"}}]}}
}
响应结果:
{"took" : 2,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 1,"max_score" : 0.5753642,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 0.5753642,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}}]}
}

2. 范围查询(range)
range 查询找出那些落在指定区间内的数字或者时间。range查询允许以下字符:
操作符 说明
gt == (greater than) 大于>
gte == (greater than equal) 大于等于>=
lt == (less than) 小于<
lte == (less than equal) 小于等于<=

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"range": {"price": {"gte": 2500,"lte": 4000}}}
}
响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 1,"max_score" : 1.0,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 1.0,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0}}]}
}

3. 模糊查询(fuzzy)
返回包含与搜索字词相似的字词的文档。
编辑距离是将一个术语转换为另一个术语所需的一个字符更改的次数。这些更改可以包括:
更改字符(box → fox)
删除字符(black → lack)
插入字符(sic → sick)
转置两个相邻字符(act → cat)
为了找到相似的术语,fuzzy查询会在指定的编辑距离内创建一组搜索词的所有可能的变体或扩展。然后查询返回每个扩展的完全匹配。
通过fuzziness修改编辑距离。一般使用默认值AUTO,根据术语的长度生成编辑距离。
0…2
必须完全匹配
3…5
允许一次编辑

5
允许进行两次编辑

POST /shopping/product/4
{"title":"apple手机","images":"http://www.gulixueyuan.com/apple.jpg","price":5999.00
}POST /shopping/product/5
{"title":"apple","images":"http://www.gulixueyuan.com/apple.jpg","price":4999.00
}
发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"fuzzy": {"title": {"value": "ccple"}}}
}	GET /shopping/_search
{"query": {"fuzzy": {"title": {"value": "ccple","fuzziness": 2}}}
}响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 0,"max_score" : null,"hits" : [ ]}
}	{"took" : 1,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 2,"max_score" : 0.41588834,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "4","_score" : 0.41588834,"_source" : {"title" : "apple手机","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 5999.0}},{"_index" : "shopping","_type" : "product","_id" : "5","_score" : 0.17260925,"_source" : {"title" : "apple","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 4999.0}}]}
}

8、【请求体查询】【查询排序】

1. 单字段排序
sort 可以让我们按照不同的字段进行排序,并且通过order指定排序的方式。desc降序,asc升序。

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"match_all": {}},"sort": [{"price": {"order": "desc"}}]
}
响应结果:
{"took" : 4,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 5,"max_score" : null,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "4","_score" : null,"_source" : {"title" : "apple手机","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 5999.0},"sort" : [5999.0]},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : null,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0},"sort" : [5999.0]},{"_index" : "shopping","_type" : "product","_id" : "5","_score" : null,"_source" : {"title" : "apple","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 4999.0},"sort" : [4999.0]},{"_index" : "shopping","_type" : "product","_id" : "2","_score" : null,"_source" : {"title" : "华为手机","images" : "http://www.gulixueyuan.com/hw.jpg","price" : 4999.0},"sort" : [4999.0]},{"_index" : "shopping","_type" : "product","_id" : "1","_score" : null,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0},"sort" : [3999.0]}]}
}

2. 多字段排序
假定我们想要结合使用 price和 _score(得分) 进行查询,并且匹配的结果首先按照价格排序,然后按照相关性得分排序:

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"match_all": {}},"sort": [{"price": {"order": "desc"}},{"_score":{"order": "desc"}}]
}
响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 5,"max_score" : null,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "4","_score" : 1.0,"_source" : {"title" : "apple手机","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 5999.0},"sort" : [5999.0,1.0]},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 1.0,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0},"sort" : [5999.0,1.0]},{"_index" : "shopping","_type" : "product","_id" : "5","_score" : 1.0,"_source" : {"title" : "apple","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 4999.0},"sort" : [4999.0,1.0]},{"_index" : "shopping","_type" : "product","_id" : "2","_score" : 1.0,"_source" : {"title" : "华为手机","images" : "http://www.gulixueyuan.com/hw.jpg","price" : 4999.0},"sort" : [4999.0,1.0]},{"_index" : "shopping","_type" : "product","_id" : "1","_score" : 1.0,"_source" : {"title" : "小米手机","images" : "http://www.gulixueyuan.com/xm.jpg","price" : 3999.0},"sort" : [3999.0,1.0]}]}
}

9、【请求体查询】【高亮查询】

在进行关键字搜索时,搜索出的内容中的关键字会显示不同的颜色,称之为高亮。
在百度搜索"京东"
在这里插入图片描述

在京东网站搜索“小米”

在这里插入图片描述

高亮显示的html分析
通过开发者工具查看高亮数据的html代码实现:

在这里插入图片描述

高亮查询请求

ElasticSearch可以对查询内容中的关键字部分,进行标签和样式(高亮)的设置。
在使用match查询的同时,加上一个highlight属性:
pre_tags:前置标签
post_tags:后置标签
fields:需要高亮的字段
title:这里声明title字段需要高亮,后面可以为这个字段设置特有配置,也可以空

发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"match": {"title": "华为"}},"highlight": {"pre_tags": "<font color='red'>","post_tags": "</font>","fields": {"title": {}}}
}
响应结果:
{"took" : 1,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 1,"max_score" : 0.6931472,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "2","_score" : 0.6931472,"_source" : {"title" : "华为手机","images" : "http://www.gulixueyuan.com/hw.jpg","price" : 4999.0},"highlight" : {"title" : ["<font color='red'>华为</font>手机"]}}]}
}

10、【请求体查询】【分页查询】

from:当前页的起始索引,默认从0开始。 from = (pageNum - 1) * size
size:每页显示多少条 
发送请求:
# 请求方法:GET
GET /shopping/_search
{"query": {"match_all": {}},"sort": [{"price": {"order": "desc"}},{"_score":{"order": "desc"}}],"from": 0,"size": 2
}响应结果:
{"took" : 0,"timed_out" : false,"_shards" : {"total" : 5,"successful" : 5,"skipped" : 0,"failed" : 0},"hits" : {"total" : 5,"max_score" : null,"hits" : [{"_index" : "shopping","_type" : "product","_id" : "4","_score" : 1.0,"_source" : {"title" : "apple手机","images" : "http://www.gulixueyuan.com/apple.jpg","price" : 5999.0},"sort" : [5999.0,1.0]},{"_index" : "shopping","_type" : "product","_id" : "3","_score" : 1.0,"_source" : {"title" : "小米电视","images" : "http://www.gulixueyuan.com/xmds.jpg","price" : 5999.0},"sort" : [5999.0,1.0]}]}
}

相关文章:

ElasticSearch的客户端操作

ElasticSearch的客户端操作 1、客户端介绍 官方文档地址&#xff1a; https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html 实际开发中&#xff0c;有多种方式操作Elasticsearch&#xff1a; 客户端工具&#xff1a;发送http请求(RESTful风格)操作…...

如何快速的合并多个PPT使之成为一个PPT?

如何快速的合并多个PPT使之成为一个PPT&#xff1f; 项目过程中&#xff0c;经常给客户汇报&#xff0c;经常做PPT&#xff0c;有时候&#xff0c;需要把之前的ppt内容整合到新的内容中&#xff0c;如何快速合并以及使用呢&#xff1f; 幻灯片&#xff08;PPT中&#xff09;点…...

【微信小程序】列表滚动触底更新实现

微信小程序开发系列 目录 前言一、上拉触底事件函数onReachBottom二、实现 前言 在微信小程序开发中经常遇到分页列表需要滚动到底部之后进行请求数据更新&#xff0c;下面介绍如何进行触底更新分页展示。使用到页面上拉触底事件的处理函数onReachBottom。 一、上拉触底事件函…...

2023全国大学生数学建模竞赛A题B题C题D题E题思路+模型+代码+论文

目录 一. 2023国赛数学建模思路&#xff1a; 赛题发布后会第一时间发布选题建议&#xff0c;思路&#xff0c;模型代码等 详细思路获取见文末名片&#xff0c;9.7号第一时间更新 二.国赛常用的模型算法&#xff1a; 三、算法简介 四.超重要&#xff01;&#xff01;&…...

Git常见操作

一、全局配置命令 配置级别&#xff1a; –local&#xff08;默认&#xff0c;高级优先&#xff09;&#xff1a;只影响本地仓库 –global(中优先级)&#xff1a;只影响所有当前用户的git仓库 –system&#xff08;低优先级&#xff09;&#xff1a;影响到全系统的git仓库 1…...

thinkphp6前后端验证码分离以及验证

1.验证码接口生成验证码: public function verify(){return captcha(); } 也可以自己写方法 2.验证方法和普通模式session验证有区别,需要改原文件: 修改后的代码: <?php // +---------------------------------------------------------------------- // | ThinkP…...

jenkinsfile自动部署接口

复制创建新流水线 从预先创建的job中获取 config.xml 或根据需要创建另一个 curl -X GET http://xxx.xxx.xxxx.com/job/backup-data/config.xml -u test:xxxxxxxxxxxxxxxxxx-o config.xml 生成Crumb CRUMB$(curl -s http://xxxxxxx.xxx.xxx.com/crumbIssuer/api/xml?xpathc…...

26. 删除有序数组中的重复项

26. 删除有序数组中的重复项 给你一个 升序排列 的数组 nums &#xff0c;请你 原地 删除重复出现的元素&#xff0c;使每个元素 只出现一次 &#xff0c;返回删除后数组的新长度。元素的 相对顺序 应该保持 一致 。然后返回 nums 中唯一元素的个数。 考虑 nums 的唯一元素的…...

vue父页面获取子组件绑定值

<el-form-item label"图文详情" prop"imageText"><div><el-button type"primary" link>组件</el-button><WangEditor v-model"ruleForm.imageText"></WangEditor></div> </el-form-item…...

FPGA_学习_17_IP核_ROM(无延迟-立即输出)

由于项目中关于厂商提供的温度-偏压曲线数据已经被同事放在ROM表了&#xff0c;我这边可用直接调用。 今天在仿真的时候&#xff0c;发现他的ROM表用的IP核是及时输出的&#xff0c;就是你地址给进去&#xff0c;对应地址的ROM数据就立马输出&#xff0c;没有延迟。 我打开他的…...

CentOS7.6安装mysql8.0.34

一、查看服务器相关信息 cat /etc/redhat-release cat /proc/version [rootlocalhost ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [rootlocalhost ~]# cat /proc/version Linux version 3.10.0-957.el7.x86_64 (mockbuildkbuilder.bsys.centos.org) …...

SCF金融公链新加坡启动会 链结创新驱动未来

新加坡迎来一场引人瞩目的金融科技盛会&#xff0c;SCF金融公链启动会于2023年8月13日盛大举行。这一受瞩目的活动将为金融科技领域注入新的活力&#xff0c;并为广大投资者、合作伙伴以及关注区块链发展的人士提供一个难得的交流平台。 在SCF金融公链启动会上&#xff0c; Wil…...

JavaScript【实例、静态方法与属性、原型链、instanceof 运算符、Object 对象的相关方法、对象的继承、多重继承、严格模式】(十九)

目录 实例、静态方法与属性 实例方法和静态方法...

【Git】本地搭建Gitee、Github环境

本地 &#xff08;Local&#xff09; 1、使用命令生成公钥&#xff08;pub文件&#xff09; 1. $ ssh-keygen -t rsa -C "xxxxxxxemail.com" -f "github_id_rsa" 2. $ ssh-keygen -t rsa -C "xxxxxxxemail.com" -f "gitee_id_rsa" …...

学习ts(四)联合类型、交叉类型、类型断言

联合类型 使用联合类型定义属性和方法&#xff0c;只要符合其中一种即可 let myPhone: string | number 010-7788 // let myPhone1: string | number true 因为没有包含boolean值 会报错const fn (something: number | boolean): boolean > {return !!something }con…...

Linux 内核与架构速查

Linux 内核与架构速查 博主博客 https://blog.uso6.comhttps://blog.csdn.net/dxk539687357 本文主要记录查询 Linux 计算机的内核与架构&#xff0c; 用于下载对应架构的第三方软件。 一、介绍 如上图所示&#xff0c; 有时候我们下载一些第三方软件&#xff0c; 软件会有很…...

【Java 动态数据统计图】动态数据统计思路案例(动态,排序,containsKey)五(117)

需求&#xff1a;前端根据后端的返回数据&#xff1a;画统计图&#xff1b; 1.动态获取地域数据以及数据中的平均值&#xff0c;按照平均值降序排序&#xff1b; 说明&#xff1a; X轴是动态的&#xff0c;有对应区域数据则展示&#xff1b; X轴 区域数据降序排序&#xff1b;…...

区块链碎碎念

现在的区块链早已过了跑马圈地的时代&#xff0c;现在还按照以前承接项目的方式做区块链只能是越来越艰难。经过几年的技术沉淀&#xff0c;做区块链项目的公司都已经没落的七七八八了。 区块链不是一个能够快速显现盈利能力的行业&#xff0c;相反这个行业目前的模式还是处于…...

4.物联网LWIP之C/S编程

LWIP配置 服务器端实现 客户端实现 错误分析 一。LWIP配置&#xff08;FREERTOS配置&#xff0c;ETH配置&#xff0c;LWIP配置&#xff09; 1.FREERTOS配置 为什么要修改定时源为Tim1&#xff1f;不用systick&#xff1f; 原因&#xff1a;HAL库与FREERTOS都需要使用systi…...

在 PyTorch 中使用关键点 RCNN 进行人体姿势估计--附源码

人体姿态估计是计算机视觉领域的一个重要研究领域。它涉及估计人体上的独特点,也称为关键点。在这篇博文中,我们将讨论一种在包含人类的图像上查找关键点的算法,称为Keypoint-RCNN。该代码是使用 Pytorch 使用Torchvision库编写的。 假设您想要建立一名私人健身教练,可以通…...

Dubbo及Zookeeper安装

...

ZK-C3595、ZK-C35100、ZK-C40100、ZK-C40110超越离合器

ZK-A3072、ZK-A3080、ZK-A4090、ZK-A3595、ZK-A35100ZK-A40100、ZK-A40110、ZK-A3072、ZK-C3080、ZK-C4090、ZK-C3595、ZK-C35100、ZK-C40100、ZK-C40110单向离合器(超越离合器) MG300M1300MG400、M1400MG500、M1500MG600、M1600MG700、M1700MG750、M1750MG800、M1800MG900、M1…...

Azure共享映像库构建VM镜像

什么是Azure共享映像库 Azure共享映像库是一项在Microsoft Azure中以共享方式存储和管理映像的服务。映像是预配置的虚拟机操作系统和应用程序的快照&#xff0c;可以用来创建多个虚拟机实例。通过将映像存储在共享映像库中&#xff0c;用户可以轻松地共享映像给其他Azure订阅…...

【C++】AVL树(平衡二叉树)

目录 一、AVL树的定义二、AVL树的作用三、AVL树的插入操作插入——平衡因子的更新插入——左单旋插入——右单旋插入——左右双旋插入——右左双旋 四、ALVL树的验证五、AVL树的性能 一、AVL树的定义 AVL树&#xff0c;全称 平衡二叉搜索&#xff08;排序&#xff09;树。 二…...

「UG/NX」Block UI 面收集器FaceCollector

✨博客主页何曾参静谧的博客📌文章专栏「UG/NX」BlockUI集合📚全部专栏「UG/NX」NX二次开发「UG/NX」BlockUI集合「VS」Visual Studio「QT」QT5程序设计「C/C+&#...

剑指Offer61.扑克牌中的顺子 C++

1、题目描述 从若干副扑克牌中随机抽 5 张牌&#xff0c;判断是不是一个顺子&#xff0c;即这5张牌是不是连续的。2&#xff5e;10为数字本身&#xff0c;A为1&#xff0c;J为11&#xff0c;Q为12&#xff0c;K为13&#xff0c;而大、小王为 0 &#xff0c;可以看成任意数字。…...

vue实例挂载过程

以下仅为个人见解。 1.大致流程&#xff1a; new Vue()时会调用initMixin(Vue)将_init挂载到vue原型上&#xff1b;在_init()中调用$mount()方法($mount()方法也是挂载到vue原型上的)编译template模版&#xff0c;并生成render()函数&#xff1b;挂载到vm上后&#xff0c;会…...

【第八讲---视觉里程计2】

在图像中提取特征点并计算特征描述&#xff0c;非常耗时 通过计算描述子距离在不同图像中寻找特征匹配&#xff0c;也非常耗时 利用通过匹配点信息计算相机位姿&#xff0c;没什么问题 我们可以采用以下方法进行改进&#xff1a; 光流&#xff1a;通过其他方式寻找匹配点直接法…...

设置PHP的fpm的系统性能参数pm.max_children

1 介绍 PHP从Apache module换成了Fpm&#xff0c;跑了几天突然发现网站打不开了。 页面显示超时&#xff0c;检查MySQL、Redis一众服务都正常。 进入Fpm容器查看日志&#xff0c;发现了如下的错误信息&#xff1a; server reached pm.max_children setting (5), consider r…...

vue3setup标签语法 + vite + delfin 递归组件实现无限评论功能

1、 功能效果 在线预览&#xff1a;https://szhihao.gitee.io/comment/ gitee仓库地址&#xff1a;https://gitee.com/szhihao/comment 2、实现的具体技术点 根据不同的人名可以进行评论&#xff08;tap切换&#xff09; 对进行的评论可以无限进行回复&#xff08;递归组件和…...

optee中如何开启或关闭所有中断的

我们知道在Linux Kernel中开启或关闭中断的函数是:local_irq_enable()和local_irq_disable(), 那么在optee os中是怎样做到的呢? optee中通过使用thread_mask_exceptions()和thread_unmask_exceptions()来开启或关闭中断。 thread_mask_exceptions()和thread_unmask_excepti…...

基于STM32+微信小程序设计的宠物投喂装置(腾讯云IOT)

一、设计需求 【1】 项目背景 社会经济的飞速发展与城市化进程的加速,城市市民家庭的封闭化和人口老龄化的情况日益突出,基于人们的情感寄托与休闲消费的需要,中国的宠物产业也悄然兴起。家庭宠物的饲养成为了城市居民生活消遣的新方式。宠物的喂养和看护往往是宠物主人最…...

2023年上半年软考分数线 软考分数线公布时间

2023年上半年软考分数线&#xff1a; 全国标准为45分&#xff0c;部分地区会有省考分数线。 计算机软考的及格分数线并不是固定的&#xff0c;就像2016年上半年中级信息系统管理工程师考试&#xff0c;上午的基础知识科目及格标准是45分&#xff0c;下午的应用技术科目及格标…...

centos7的flink安装过程

安装步骤 下载flink的tar.gz包修改flink的conf配置下载需要的lib包 具体代码&#xff08;以flink1.15为例&#xff09; # 下载flink的tar.gz包 wget https://archive.apache.org/dist/flink/flink-1.15.4/flink-1.15.4-bin-scala_2.12.tgz tar -zxvf flink-1.15.4-bin-scala…...

商城-学习整理-高级-性能压测缓存问题(十一)

目录 一、基本介绍1、性能指标2、JMeter1、JMeter 安装2、JMeter 压测示例1、添加线程组2、添加 HTTP 请求3、添加监听器4、启动压测&查看分析结果 3、JMeter Address Already in use 错误解决 二、性能监控1、jvm 内存模型2、堆3、jconsole 与 jvisualvm1、jvisualvm 能干…...

PHP 三元 !empty 而不是评估为真或假 可用isset()

是否可以使用速记三元来检查变量是否已设置&#xff0c;而不是是否计算结果为零或非零&#xff1f; 例如&#xff0c;我试过&#xff1a; $var 0; echo (string) $var ?: (string) false ?: 2;但由于前两个表达式的计算结果均为“0”或“false”&#xff0c;因此显示为 2。…...

星火大模型 VS FuncGPT(慧函数), 谁更胜一筹?

哈喽&#xff0c;本文即通过相近的试题&#xff0c;看下最近爆火的科大讯飞星火大模型和 FuncGPT&#xff08;慧函数&#xff09;的编码能力有何区别&#xff0c;给大家直观地对比。 开发过程中经常会遇到读取文件内容的情况&#xff0c;需要【判断文件路径是目录还是文件】&am…...

使用 Python 获取 Redis 数据库中的所有键

如果你了解 JSON&#xff0c;就会熟悉 Redis 设计系统。 它使用键值结构和分布式内存方法来实现弹性数据库。 哈希、列表、集合、排序集合、字符串、JSON 和流是 Redis 支持的众多数据结构之一。 这个开源数据库支持不同的语言&#xff0c;包括 Python&#xff0c;如果您正在使…...

C的进阶C++学习方向

(꒪ꇴ꒪ )&#xff0c;Hello我是祐言QAQ我的博客主页&#xff1a;C/C语言&#xff0c;Linux基础&#xff0c;ARM开发板&#xff0c;软件配置等领域博主&#x1f30d;快上&#x1f698;&#xff0c;一起学习&#xff0c;让我们成为一个强大的攻城狮&#xff01;送给自己和读者的…...

【仿写框架之仿写Tomact】二、初始化阶段加载项目中所有servlet类对象

文章目录 1、自定义MyWebServlet 注解2、创建HttpServlet文件3、加载项目中的所有以.java结尾的文件4、收集项目中带有MyWebServlet 的类对象 1、自定义MyWebServlet 注解 我们知道&#xff0c;tomcat是依据WebServlet注解去收集所有servlet类的。 import java.lang.annotati…...

Linux实用运维脚本分享

Linux实用运维脚本分享&#x1f343; MySQL备份 目录备份 PING查询 磁盘IO检查 性能相关 进程相关 javadump.sh 常用工具安装 常用lib库安装 系统检查脚本 sed进阶 MySQL备份 #!/bin/bashset -eUSER"backup" PASSWORD"backup" # 数据库数据目录…...

JMeter 特殊组件-逻辑控制器与BeanShell PreProcessor 使用示例

文章目录 前言JMeter 特殊组件-逻辑控制器与BeanShell PreProcessor 使用示例1. 逻辑控制器使用1.1. While Controller 使用示例1.2. 如果&#xff08;If&#xff09;控制器 使用示例 2. BeanShell PreProcessor 使用示例 前言 如果您觉得有用的话&#xff0c;记得给博主点个赞…...

时序预测 | MATLAB实现SA-ELM模拟退火算法优化极限学习机时间序列预测

时序预测 | MATLAB实现SA-ELM模拟退火算法优化极限学习机时间序列预测 目录 时序预测 | MATLAB实现SA-ELM模拟退火算法优化极限学习机时间序列预测预测效果基本介绍程序设计参考资料 预测效果 基本介绍 MATLAB实现SA-ELM模拟退火算法优化极限学习机时间序列预测 程序设计 完整…...

Ubuntu 连接海康智能相机步骤(亲测,成功读码)

ubuntu20.04下连接海康智能相机 Ubuntu 连接海康智能相机步骤(亲测&#xff0c;已成功读码)输出的结果 Ubuntu 连接海康智能相机步骤(亲测&#xff0c;已成功读码) (就是按照海康的提供的步骤和源码连接相机&#xff0c;流水账) 安装Ubuntu20.04安装gcc和g&#xff0c;IDmvs只…...

sass笔记

声明变量 通过$标识符进行命名及引用混合器 类似vue中的函数 通过 mixin标识定义 include 标识调用& 父选择器标识extend 进行继承可嵌套可导入 通过 import 文件位置’ 、进行导入 <style> //1 声明变量 $name: 15px; $color: skyblue;mixin border-radius($num) {/…...

C/C++中volatile关键字详解

1. 为什么用volatile? C/C 中的 volatile 关键字和 const 对应&#xff0c;用来修饰变量&#xff0c;通常用于建立语言级别的 memory barrier。这是 BS 在 "The C Programming Language" 对 volatile 修饰词的说明&#xff1a; A volatile specifier is a hint to a…...

Linux:shell脚本:基础使用(4)《正则表达式-grep工具》

正则表达式定义&#xff1a; 使用单个字符串来描述&#xff0c;匹配一系列符合某个句法规则的字符串 正则表达式的组成&#xff1a; 普通字符串: 大小写字母&#xff0c;数字&#xff0c;标点符号及一些其他符号 元字符&#xff1a;在正则表达式中具有特殊意义的专用字符 正则表…...

如何建立单元测试

快速开始 zixun-quickstart-mk3生成的项目已经配置好了基础的BaseTest,各个测试类只需要继承BaseTest就可以开始进行单元测试的编写了。 如何进行Mock 为了保证独立性和可重复执行,所有的外部依赖都需要进行Mock,SpringTest引入了Mockito作为单测Mock组件, Mickito官方文…...

typeScript 接口和类

工具&#xff1a; PlayGround 接口 接口用来定义对象的结构和类型&#xff0c;描述对象应该具有哪些属性和方法。 它仅用于声明&#xff0c;而不是实现&#xff1b; 这对于编写可重用的代码非常有用。它可用于&#xff1a; 关键字是interface&#xff0c; 注意&#xff1a;它…...

这项与越来越多企业有关的行业标准,网易云信深度参与制定!

近日&#xff0c;由中国信息通信研究院主办的 2023 数字生态发展大会暨中国信通院“铸基计划”年中会议在北京召开。本次大会发布了中国信通院在行业数字化转型中的观察和实践&#xff0c;并发布了中国信通院在数字化转型领域的多项工作成果。大会定向邀请了来自通信、云计算、…...