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