Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KubeSphere
kubesphere
提交
71b2b78c
K
kubesphere
项目概览
KubeSphere
/
kubesphere
通知
144
Star
32
Fork
5
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
71b2b78c
编写于
5月 29, 2020
作者:
H
huanggze
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
logging: start_time and end_time are not required params
Signed-off-by:
N
huanggze
<
loganhuang@yunify.com
>
上级
a575c3ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
8 deletion
+30
-8
pkg/simple/client/logging/elasticsearch/api_body.go
pkg/simple/client/logging/elasticsearch/api_body.go
+9
-8
pkg/simple/client/logging/elasticsearch/api_body_test.go
pkg/simple/client/logging/elasticsearch/api_body_test.go
+6
-0
pkg/simple/client/logging/elasticsearch/testdata/api_body_7.json
...ple/client/logging/elasticsearch/testdata/api_body_7.json
+15
-0
未找到文件。
pkg/simple/client/logging/elasticsearch/api_body.go
浏览文件 @
71b2b78c
...
...
@@ -119,14 +119,15 @@ func (bb *bodyBuilder) mainBool(sf logging.SearchFilter) *bodyBuilder {
ms
=
append
(
ms
,
Match
{
Bool
:
&
b
})
}
if
!
sf
.
Starttime
.
IsZero
()
||
!
sf
.
Endtime
.
IsZero
()
{
fromTo
:=
Match
{
Range
:
&
Range
{
&
Time
{
Gte
:
&
sf
.
Starttime
,
Lte
:
&
sf
.
Endtime
,
}},
}
ms
=
append
(
ms
,
fromTo
)
r
:=
&
Range
{
Time
:
&
Time
{}}
if
!
sf
.
Starttime
.
IsZero
()
{
r
.
Gte
=
&
sf
.
Starttime
}
if
!
sf
.
Endtime
.
IsZero
()
{
r
.
Lte
=
&
sf
.
Endtime
}
if
r
.
Lte
!=
nil
||
r
.
Gte
!=
nil
{
ms
=
append
(
ms
,
Match
{
Range
:
r
})
}
bb
.
Body
.
Query
=
&
Query
{
Bool
{
Filter
:
ms
}}
...
...
pkg/simple/client/logging/elasticsearch/api_body_test.go
浏览文件 @
71b2b78c
...
...
@@ -45,6 +45,12 @@ func TestMainBool(t *testing.T) {
},
expected
:
"api_body_4.json"
,
},
{
filter
:
logging
.
SearchFilter
{
Starttime
:
time
.
Unix
(
1590744676
,
0
),
},
expected
:
"api_body_7.json"
,
},
}
for
i
,
test
:=
range
tests
{
...
...
pkg/simple/client/logging/elasticsearch/testdata/api_body_7.json
0 → 100644
浏览文件 @
71b2b78c
{
"query"
:{
"bool"
:{
"filter"
:[
{
"range"
:{
"time"
:{
"gte"
:
"2020-05-29T17:31:16+08:00"
}
}
}
]
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录