这是我索引中的文档(也可以有几个):
{
"_index" : "meeting",
"_type" : "meeting",
"_id" : "27",
"_score" : 1.0,
"_source" : {
"createTime" : "2020-07-20T14:49:05.803",
"createTimeInMs" : 1595234945803,
"createdBy" : "sdf@sdfsd.com",
"editTime" : "2020-07-20T14:49:05.803",
"editTimeInMs" : 1595234945803,
"editedBy" : "sfsf@sdfsdf.com",
"versionId" : 1,
"id" : "27",
"projectId" : "62",
"projectName" : "sdfsdf",
"meetingName" : "meeting1",
"agenda" : "string",
"startDateString" : "2020-07-20T00:45:19.604",
"userId" : 3,
"memberList" : [
3,
4
],
"status" : "ACTIVE",
"timeZone" : "Asia/Dhaka",
"startDate" : "2020-07-20T00:45:19.604",
"endDate" : "2020-07-20T01:45:19.604",
"dateInMS" : 1595227519000,
"meetingPlace" : "string",
"endDateString" : "2020-07-20T01:45:19.604"
}
}
从逻辑上讲,我正在尝试建立这种条件:
if((projectId==62 && startDate>=inputFrom && startDate <=inputTo) && (status==ACTIVE ||status==POSTPONED))
我的查询(来自 kibana):
GET /meeting/_search?pretty
{
"query":
{
"bool" : {
"must" : [
{
"term" : {
"projectId" : {
"value" : "62",
"boost" : 1.0
}
}
},
{
"terms" : {
"status" : [
"ACTIVE",
"POSTPONED"
],
"boost" : 1.0
}
},
{
"range" : {
"startDate" : {
"from" : "2020-07-19T23:45:19.604Z",
"to" : "2020-07-20T00:49:19.604Z",
"include_lower" : true,
"include_upper" : true,
"boost" : 1.0
}
}
}
],
"adjust_pure_negative" : true,
"boost" : 1.0
}
}
}
我正在将startDate
上述范围内的字段的范围查询与上述其他must
字段进行比较。但没有受到任何打击!我想检索在给定和日期startDate
范围内的文档。
在这个领域相当缺乏经验,不知道为什么不工作!请帮助如何修复此查询来做到这一点?from
to