Skip to content

Commit 938bfec

Browse files
PSeitzPSeitz-dd
andauthored
use FxHashMap for Aggregations Request (#2722)
Co-authored-by: Pascal Seitz <[email protected]>
1 parent dabcaa5 commit 938bfec

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/aggregation/agg_req.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
//! let _agg_req: Aggregations = serde_json::from_str(elasticsearch_compatible_json_req).unwrap();
2727
//! ```
2828
29-
use std::collections::{HashMap, HashSet};
29+
use std::collections::HashSet;
3030

31+
use rustc_hash::FxHashMap;
3132
use serde::{Deserialize, Serialize};
3233

3334
use super::bucket::{
@@ -43,7 +44,7 @@ use super::metric::{
4344
/// defined names. It is also used in buckets aggregations to define sub-aggregations.
4445
///
4546
/// The key is the user defined name of the aggregation.
46-
pub type Aggregations = HashMap<String, Aggregation>;
47+
pub type Aggregations = FxHashMap<String, Aggregation>;
4748

4849
/// Aggregation request.
4950
///

src/aggregation/bucket/term_agg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,8 @@ mod tests {
23622362
let mut agg_res = search(&index, &agg_req)?;
23632363

23642364
// --- Aggregations: terms on host and tags ---
2365-
let mut agg_req2: Aggregations = Aggregations::with_capacity(20);
2365+
let mut agg_req2: Aggregations =
2366+
Aggregations::with_capacity_and_hasher(20, Default::default());
23662367
agg_req2.insert(
23672368
"tags".to_string(),
23682369
serde_json::from_value(json!({ "terms": { "field": "tags" } }))?,

0 commit comments

Comments
 (0)