Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
easy-es
easy-es
提交
88a86888
E
easy-es
项目概览
easy-es
/
easy-es
通知
96
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
easy-es
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
88a86888
编写于
12月 03, 2021
作者:
FelixHPP
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build:1.1.0版本, 修复批量新增API bug
上级
33f33e02
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
3 deletion
+28
-3
easy-es-core/pom.xml
easy-es-core/pom.xml
+1
-1
easy-es-core/src/main/java/indi/felix/easy/core/elastic/EasyEs.java
...re/src/main/java/indi/felix/easy/core/elastic/EasyEs.java
+9
-1
easy-es-core/src/main/java/indi/felix/easy/core/elastic/rest/SearchRestApi.java
...java/indi/felix/easy/core/elastic/rest/SearchRestApi.java
+17
-0
pom.xml
pom.xml
+1
-1
未找到文件。
easy-es-core/pom.xml
浏览文件 @
88a86888
...
...
@@ -5,7 +5,7 @@
<parent>
<artifactId>
easy-es
</artifactId>
<groupId>
indi.felix.easy
</groupId>
<version>
1.
0.9
</version>
<version>
1.
1.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
easy-es-core
</artifactId>
...
...
easy-es-core/src/main/java/indi/felix/easy/core/elastic/EasyEs.java
浏览文件 @
88a86888
...
...
@@ -182,6 +182,14 @@ public class EasyEs {
// return responseBody(defaultMethod, newEndpoint);
// }
/**
* 批量新增
* @param index 索引名称
* @param objects 批量插入的对象
* @param idKey ID字段名称, 没有传入null
* @param routingKey 作为routing字段的名称,没有传入null
* @param parentKey 作为parent字段的名称, 没有传入null
*/
public
void
bulkAddDoc
(
String
index
,
List
<
Map
>
objects
,
String
idKey
,
String
routingKey
,
String
parentKey
)
{
BulkRequest
request
=
new
BulkRequest
();
...
...
@@ -192,7 +200,7 @@ public class EasyEs {
throw
new
ElasticsearchException
(
"mappers can not be empty"
);
}
search
().
bulkInsert
(
index
,
objects
,
2000
);
search
().
bulkInsert
(
index
,
objects
,
2000
,
idKey
,
routingKey
,
parentKey
);
}
public
void
bulkAddDoc
(
String
index
,
List
<
Map
>
objects
)
{
...
...
easy-es-core/src/main/java/indi/felix/easy/core/elastic/rest/SearchRestApi.java
浏览文件 @
88a86888
...
...
@@ -46,6 +46,19 @@ public class SearchRestApi extends BaseRest {
return
responseBody
(
defaultMethod
,
newEndpoint
,
dsl
);
}
/**
*
* @param index 多个索引查询用逗号分割
* @param routing routing, 多个用逗号隔开
* @param dsl
* @return
*/
public
String
requestDsl
(
String
index
,
String
routing
,
String
dsl
)
{
String
newEndpoint
=
MessageFormat
.
format
(
"/{0}/_search?routing={1}"
,
index
,
routing
);
return
responseBody
(
defaultMethod
,
newEndpoint
,
dsl
);
}
/**
* 查询指定ID的文档
* 如果索引设置了routing, 会报routing_missing_exception 异常
...
...
@@ -103,6 +116,10 @@ public class SearchRestApi extends BaseRest {
return
requestDsl
(
index
,
queryBuilder
.
toString
());
}
public
String
requestByQuery
(
String
index
,
String
routing
,
SearchSourceBuilder
queryBuilder
)
{
return
requestDsl
(
index
,
routing
,
queryBuilder
.
toString
());
}
/**
* 根据查询条件查询指定索引文档
* @param index
...
...
pom.xml
浏览文件 @
88a86888
...
...
@@ -7,7 +7,7 @@
<groupId>
indi.felix.easy
</groupId>
<artifactId>
easy-es
</artifactId>
<packaging>
pom
</packaging>
<version>
1.
0.9
</version>
<version>
1.
1.0
</version>
<modules>
<module>
easy-es-core
</module>
<!-- <module>easy-es-spring</module>-->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录