mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2025-12-23 02:29:57 +00:00
use FxHashMap for Aggregations Request (#2722)
Co-authored-by: Pascal Seitz <pascal.seitz@datadoghq.com>
This commit is contained in:
@@ -26,8 +26,9 @@
|
||||
//! let _agg_req: Aggregations = serde_json::from_str(elasticsearch_compatible_json_req).unwrap();
|
||||
//! ```
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::collections::HashSet;
|
||||
|
||||
use rustc_hash::FxHashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::bucket::{
|
||||
@@ -43,7 +44,7 @@ use super::metric::{
|
||||
/// defined names. It is also used in buckets aggregations to define sub-aggregations.
|
||||
///
|
||||
/// The key is the user defined name of the aggregation.
|
||||
pub type Aggregations = HashMap<String, Aggregation>;
|
||||
pub type Aggregations = FxHashMap<String, Aggregation>;
|
||||
|
||||
/// Aggregation request.
|
||||
///
|
||||
|
||||
@@ -2362,7 +2362,8 @@ mod tests {
|
||||
let mut agg_res = search(&index, &agg_req)?;
|
||||
|
||||
// --- Aggregations: terms on host and tags ---
|
||||
let mut agg_req2: Aggregations = Aggregations::with_capacity(20);
|
||||
let mut agg_req2: Aggregations =
|
||||
Aggregations::with_capacity_and_hasher(20, Default::default());
|
||||
agg_req2.insert(
|
||||
"tags".to_string(),
|
||||
serde_json::from_value(json!({ "terms": { "field": "tags" } }))?,
|
||||
|
||||
Reference in New Issue
Block a user