This is the doc I have in my index(there can be several too):
{
"_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"
}
}
Logically, I am trying to build this condItion:
if((projectId==62 && startDate>=inputFrom && startDate <=inputTo) && (status==ACTIVE ||status==POSTPONED))
My Query(from 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
}
}
}
I am comparing with range query for startDate
field within mentioned range with other must
fields above. But not getting any hit!
I want to retrieve documents which has startDate
within the range of given from
and to
date.
Being quite inexperienced in this arena, don't know why not working! Please help how to fix this query to do that?