From 6614a2cba02588ab65e784df754c8de37b8b18f0 Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Wed, 20 Apr 2022 12:02:38 +0800 Subject: [PATCH] fix is_fast for bytes field --- src/aggregation/bucket/term_agg.rs | 4 ++++ src/schema/field_type.rs | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/aggregation/bucket/term_agg.rs b/src/aggregation/bucket/term_agg.rs index 801133f9b..01a967a10 100644 --- a/src/aggregation/bucket/term_agg.rs +++ b/src/aggregation/bucket/term_agg.rs @@ -104,6 +104,10 @@ pub struct TermsAggregation { /// Set the order. `String` is here a target, which is either "_count", "_key", or the name of /// a metric sub_aggregation. /// + /// Single value metrics like average can be adressed by its name. + /// Multi value metrics like stats are required to adress their field by name e.g. + /// "stats.avg" + /// /// Examples in JSON format: /// { "_count": "asc" } /// { "_key": "asc" } diff --git a/src/schema/field_type.rs b/src/schema/field_type.rs index fe096ae6f..39798e45e 100644 --- a/src/schema/field_type.rs +++ b/src/schema/field_type.rs @@ -188,13 +188,14 @@ impl FieldType { /// returns true if the field is fast. pub fn is_fast(&self) -> bool { match *self { + FieldType::Bytes(ref bytes_options) => bytes_options.is_fast(), FieldType::Str(ref text_options) => text_options.is_fast(), FieldType::U64(ref int_options) | FieldType::I64(ref int_options) | FieldType::F64(ref int_options) | FieldType::Date(ref int_options) => int_options.get_fastfield_cardinality().is_some(), FieldType::Facet(_) => true, - _ => false, + FieldType::JsonObject(_) => false, } }