I have to get records (training) wherein I have a start_date, and I have to get all records that have not yet ended. So I don't have an end_date field, but just the start date, so end_date is start_date + 60 days. So what I need comprises all results that have "start_date" less than equal to "now" and "start_date + 60 days" greater than equal to "now" i.e. "now" is between start_date and "start_date + 60 days".
So here's what I am trying. But I know "on_demand_start_date+60d" is incorrect. Can anyone help, how can this be done?
"must": [
{
"range": {
"on_demand_start_date+60d": {
"gte": "now"
}
}
},
{
"range": {
"on_demand_start_date": {
"lte": "now"
}
}
}
]
Below is a sample document: { "_index": "cdc_sse_content", "_type": "doc", "_id": "cdc_sse_publish_1140", "_score": null, "_source": { "country": "us", "event_source_time_zone": "", "source": "CVENT", "iSAPIRecord": true, "index_type": "content", "content_title": "***Test - API March 04 - 1", "event_technology": [ "Cloud & Computing", "Collaboration", "Services (CX)" ], "language_code": "en", "application_name": "event-selector", "event_type": "Hybrid event", "event_region": [ "North America" ], "event_time_zone": "UTC", "cdc_page_url": "https://www.google.com?EID=<95929>", "event_end_date": "2022-02-05T01:00", "event_filters": "", "created_by": "shaiwsha", "live_stream_end_date": null, "marketing_owner": "tparida", "event_on-demand_details": "", "search_filter_lables": [ "On-demand" ], "kafka": { "consumer_group": "sseadmin", "partition": 0, "offset": 181002, "topic": "SSEAdminContentPublished", "key": null }, "updated_by": "shaiwsha", "publish_date": "2022-02-15", "event_start_date": "2022-02-04T17:00", "status": "active", "eid": "95929", "es_index_fail": false, "cdc_id": "event-selector_1140", "event_image_url": "https://www.cisco.com/c/dam/assets/events/i/event-selector/2021/rsa_global_events_page_br_dark_600x400.png", "description": "Test 1 - This is a sample Hybrid event, that should the event type,Hybrid with City and country displayed. This is a sample In-Person that should disp", "selector_id": "cdc_event-selector_publish_1140", "event_livestream_url": "", "locale": "en_us", "event_registration_url": "https://sandbox-www.cvent.com/d/p7qgmk/4W?&EID=95929", "event_live_stream_details": "", "event_city": "Santa Clara", "event_registration_and_location_details": "", "@version": "1", "event_details": "", "start_date": "2022-02-07T19:37", "registration_start_date": "2022-02-18T09:00", "event_industry": [ "Manufacturing" ], "event_language": [ "Cantonese", "Dutch", "English" ], "event_state": "California", "live_stream_start_date": null, "on_demand_url": "https://www.google.com", "on_demand": [ "On-demand" ], "@timestamp": "2022-03-15T07:28:08.821Z", "registration_end_date": "2022-02-20T09:00", "recent_search_published_date": "2022-03-10T14:17:30.320Z", "event_country": "USA", "featured_event": [ "Featured event" ], "created_date": "2022-03-10T10:08:05.801Z", "last_update_ts": "2022/3/10 14:19:5", "updated_date": "2022-03-10T14:19:05.693Z" }, "sort": [ 1643994000000 ] }