pub struct Sort { /* private fields */ }Expand description
A single sort key. Produced by .asc() / .desc() on a sortable handle, by
Sort::score / Sort::script, or by Geo::distance_sort; chain the
option setters (missing_first, mode, unmapped_type, …) onto it.
Implementations§
Source§impl Sort
impl Sort
Sourcepub fn script(
script_type: ScriptSortType,
source: impl Into<String>,
order: SortOrder,
) -> Self
pub fn script( script_type: ScriptSortType, source: impl Into<String>, order: SortOrder, ) -> Self
Sort by a computed script value. script_type is the emitted value type
(ScriptSortType::Number / ScriptSortType::String); source is
the painless expression.
Sourcepub fn missing_first(self) -> Self
pub fn missing_first(self) -> Self
Place documents missing this field first.
Sourcepub fn missing_last(self) -> Self
pub fn missing_last(self) -> Self
Place documents missing this field last.
Sourcepub fn missing(self, value: impl Into<Value>) -> Self
pub fn missing(self, value: impl Into<Value>) -> Self
Substitute a literal value for documents missing this field.
Sourcepub fn unmapped_type(self, unmapped_type: impl Into<String>) -> Self
pub fn unmapped_type(self, unmapped_type: impl Into<String>) -> Self
Type to assume when the field is unmapped on some shard (instead of
failing the search), e.g. "long".
Sourcepub fn numeric_type(self, numeric_type: NumericType) -> Self
pub fn numeric_type(self, numeric_type: NumericType) -> Self
Numeric type to sort as (NumericType), for cross-index type coercion.
Sourcepub fn nested(self, path: impl Into<String>) -> Self
pub fn nested(self, path: impl Into<String>) -> Self
Sort by a field inside a nested array, scoped to path.
Sourcepub fn nested_filtered<S>(
self,
path: impl Into<String>,
filter: impl AsQuery<S>,
) -> Self
pub fn nested_filtered<S>( self, path: impl Into<String>, filter: impl AsQuery<S>, ) -> Self
Sort by a field inside a nested array scoped to path, considering
only elements matching filter.