Daily exports need an explicit rule assigning the midnight boundary to one window. Confirm the time field and inclusive or exclusive endpoints instead of adjusting totals by manually subtracting a second.
Decide what a day means for this dataset
Business-event time, provider receipt time and last-update time can select different records. Document the chosen field, timezone and supported precision. Do not filter on one field and diagnose missing records using another timestamp displayed in the browser.
For a query you control, an inclusive start and exclusive end gives adjacent windows a clear shared boundary: the instant excluded from the first belongs to the next. An external API may use a different convention, so adapt to its published contract. Elasticsearch’s range operators illustrate the distinction between inclusive and exclusive comparisons; they are not parameters guaranteed to exist in an SMS API.

Test the instant on each side of the boundary
| Fixture | First half-open window | Next half-open window |
|---|---|---|
| Immediately before the boundary | Included | Excluded |
| Exactly at the boundary | Excluded | Included |
| Immediately after the boundary | Excluded | Included |
These expectations describe that window design, not a provider’s default. Keep the precision the data actually uses. Subtracting one second from an inclusive end can omit sub-second records, while rounding a millisecond timestamp for display can make two distinct instants look identical.
If an integration converts local dates into another time representation, check the resulting instants as well as the displayed dates. The exported record’s real timestamp should determine its window, with any conversion rules applied consistently to the query and the verification fixture.
Check whether the export interface accepts date-only input or full timestamps. A date-only control may expand the value according to a configured timezone, whereas an API timestamp can identify an explicit instant. Capture the effective request bounds during testing so the visible calendar selection does not obscure the actual interval.
Correct boundaries do not guarantee a complete snapshot
A record can arrive late or become queryable after the export ran. Window assignment answers where that record belongs; it does not show that every eligible record existed in the query result at execution time. Define when an export becomes final and whether a controlled recheck is needed for your system’s actual behaviour.

Where a recheck can return an earlier record again, use a documented stable identity to distinguish it from a new record. Specify whether a rerun replaces a prior output or creates a clearly labelled revision. Recipients should not have to guess whether adding two files together will double-count the same messages.
Retain the query field, precise window, execution time and output scope with the managed export job. To investigate an omission, trace a known authorised record and its stored time first. An expanded diagnostic query may help locate it, but label that result separately rather than presenting the wider interval as the original day’s official export.
Reference: Elasticsearch: inclusive and exclusive range bounds.
