How to filter out the data between a start and end date using filterPredicate in Angular Material Data Table?

末鹿安然 提交于 2019-12-08 19:19:30

First, you need to add the Range filter, or Range must in your query to get the result set between the required dates. Once you got the correct result set, then you can aggregation and filter the data according to you requirement.

POST _search
{
    "query": {
        "bool": {
          "filter": [
            {
              "range": {
                "endDate": {
                  "gte": "2018-07-30",
                  "format": "yyyy-MM-dd"
                }
              }
            },
            {
              "range": {
                "startDate": {
                  "lte": "2018-08-30",
                  "format": "yyyy-MM-dd"
                }
              }
            }
          ]
        }
    }
}

Hope this will solve you problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!