You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error messages are like:
"Invalid aggregation request: data did not match any variant of untagged enum
Aggregation at line 18 column 2"
Currently the top level entry for an aggregation request uses #[serde(untagged)], which is trying to deserialize variants until one works. That's why we always get the above error message.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum Aggregation {
/// Bucket aggregation, see [BucketAggregation] for details.
Bucket(BucketAggregation),
/// Metric aggregation, see [MetricAggregation] for details.
Metric(MetricAggregation),
}
So ideally we would just flatten the buckets and metrics into a single enum, but serde does not support flattening on enums (serde-rs/serde#1402).
I see 3 Options currently:
Wait for/Implement flatten on enums in serde
Manually flatten the enums to the top-level (Internally that would be just an intermediate struct)
Use a custom deserializer (Ideally it would only manually implement the matching on the keys ("terms", "histogram", etc.) and use the defaults for the rest)
The text was updated successfully, but these errors were encountered:
Error messages are like:
"Invalid aggregation request: data did not match any variant of untagged enum
Aggregation at line 18 column 2"
Currently the top level entry for an aggregation request uses
#[serde(untagged)]
, which is trying to deserialize variants until one works. That's why we always get the above error message.Effectively Aggregations are externally tagged (https://serde.rs/enum-representations.html).
So ideally we would just flatten the buckets and metrics into a single enum, but serde does not support flattening on enums (serde-rs/serde#1402).
I see 3 Options currently:
The text was updated successfully, but these errors were encountered: