opensearch_dsl/search/sort/sort_mode.rs
1/// OpenSearch supports sorting by array or multi-valued fields. The `mode`
2/// option controls what array value is picked for sorting the document it
3/// belongs to.
4///
5/// The default sort mode in the ascending sort order is `min` — the lowest
6/// value is picked. The default sort mode in the descending order is `max` —
7/// the highest value is picked.
8///
9/// <https://www.elastic.co/guide/en/opensearch/reference/current/sort-search-results.html#_sort_mode_option>
10#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
11#[serde(rename_all = "snake_case")]
12pub enum SortMode {
13 /// Pick the lowest value.
14 Min,
15
16 /// Pick the highest value.
17 Max,
18
19 /// Use the sum of all values as sort value.\
20 /// Only applicable for number based array fields.
21 Sum,
22
23 /// Use the average of all values as sort value.\
24 /// Only applicable for number based array fields.
25 Avg,
26
27 /// Use the median of all values as sort value.\
28 /// Only applicable for number based array fields.
29 Median,
30}