Styxis
Company
Knowledge

An OpenSearch date_nanos bucket returns 0: inspect range-rewrite units before changing source data

Separate search results from the aggregation fast path.

Another path behind correct hits

Separate search results from the aggregation fast path. Compare optimized buckets with an independent calculation from approved source instants and boundaries. Place Truthound at that result comparison; correct query hits do not validate another aggregation path. [1, 2, 3]

Optimization conditions by segment

OpenSearch #23403 reports a date_nanos range-aggregation fast path encoding millisecond bounds as nanosecond points. It provides runs on 2.16.0, 2.19.7 and 3.9.0 and conditions governing optimization per segment. Query and segment merges can change eligibility, so the reported runs do not establish identical behavior in every deployment. [1]

Separate a bypass from an independent oracle

Compare optimized and bypass paths with the same documents, boundaries and segment conditions; withhold aggregates that disagree with the independent bucket reference. Fix resolution and boundary inclusivity, inspect optimization through profile and calculate source-key membership independently rather than copying the bypass result as the sole oracle. [1, 3]

A count defined by two source instants

The illustrative source has documents at 2024-01-15 and 2024-01-20, inside the range from 2024-01-01 inclusive to 2024-02-01 exclusive. Expected count from those source instants is 2. Observed 2 meets only the count condition; 0 fails. Document identity and sub-millisecond boundary behavior need separate checks. [1, 3]

Check a prepared expected aggregate

Truthound Core Python SDK 3.3.2 can compare prepared independent_bucket_documents and observed_bucket_documents through ColumnPairValidator with relationship="==". The operator decodes source instants and approved boundaries to prepare the expected aggregate. The SDK does not repair BKD bound conversion or optimization; matching counts do not establish all document membership. [1, 2, 3]

Bounds to retest after merges

Assess the performance and scope costs of script or rewrite-disable workarounds. Script, missing, overlapping ranges or a query that does not cover a whole segment change fast-path eligibility. Retest the target correction around segment merges and just inside and outside the bounds. [1, 3]

Application conditions

Fix date resolution and boundary rules, and confirm optimized segments through profile.

Alternatives

Assess the cost of a script or disabled rewrite and test the supported correction on the same bounds.

Limitations

  • The SDK does not repair BKD conversion or optimization; counts do not prove membership or all merge conditions correct.

Evidence

Event checked
Subject checked
Modified