Output
"_source" : {
"mortgagesObj" : [
{
"regDate" : "04/06/2020"
},
{
"regDate" : "01/10/2013"
},
{
"regDate" : "15/09/2016"
},
{
"regDate" : "02/10/2013"
},
{
"regDate" : "01/10/2013"
},
{
"regDate" : "14/12/2015"
},
{
"regDate" : "15/09/2016"
},
{
"regDate" : "15/06/2020"
},
{
"regDate" : "09/06/2020"
},
{
"regDate" : "07/10/2013"
},
{
"regDate" : "05/06/2020"
},
{
"regDate" : "09/06/2020"
}
]
}
Query
"query": {
"nested": {
"path": "mortgagesObj",
"query": {
"bool": {
"must": [
{
"range": {
"mortgagesObj.regDate": {
"gte": "01/01/2020",
"lte": "24/08/2020",
"format": "dd/MM/yyyy||yyyy"
}
}
}
]
}
}
}
}
Question
Question 1 : I want to select field only between '01/01/2020' and '24/08/2020', but I am getting all the fields inside that array which I do not want.
Question 2 : Is it possible to count number of fields inside an array when I getting the output?