ElasticSearch:使用小时范围过滤器独立日期查询深日期字段

时间:2017-01-16 03:59:46

标签: java elasticsearch

如何使用字段

查询所有广告
("group": { "times": [{"startTime", "startTime"}]}) 

无论日期是什么,查询都基于小时范围。

我的索引就像(例如“startTime”:“2016-12-13T09:00:00 + 08:00”, “endTime”:“2016-12-13T22:00:00 + 08:00”,但我只关心"09:00:00""22:00:00"):

{
"_index": "advert",
"_type": "advert",
"_id": "6217903907666941952",
"_score": 7.730222,
"_source": {
    "id": "6217903907666941952",
    "promotionUrl": "http://www.baidu.com",
    "summary": "test",
    "user": {
        "createdBy": "ag-kf",
        "createdDate": "2016-12-05T11:48:52+08:00",
        "lastModifiedBy": "admin",
        "lastModifiedDate": "2016-12-13T14:10:52+08:00",
        "id": "6211385611895442432",
        "login": "ag-ggz02",
        "email": "testing0000019@21cn.com",
        "region": null,
        "activated": true,
        "locked": false,
        "langKey": "zh-cn"
    },
    "group": {
        "createdBy": "ag-ggz02",
        "id": "6214281669688469248",
        "name": "AGggz002推广测试02",
        "dailyLimit": 500,
        "deliveryChannelsLimit": 5,
        "startDate": "2017-01-12T00:00:00+08:00",
        "endDate": "2017-01-19T00:00:00+08:00",
        "paymentMode": "CPC",
        "deliveryMode": "SPEEDUP",
        "status": "VALID",
        "times": [
            {
                "createdBy": "ag-ggz02",
                "createdDate": "2017-01-12T14:40:59+08:00",
                "lastModifiedBy": "ag-ggz02",
                "lastModifiedDate": "2017-01-12T14:40:59+08:00",
                "id": "6225199665533659392",
                "startTime": "2016-12-13T09:00:00+08:00",
                "endTime": "2016-12-13T22:00:00+08:00"
            }
        ]
    }
}}

0 个答案:

没有答案