Skip to content
Gallery
Stack Developer Resources
Share
Explore
ElasticSearch

Sort

This guide will provide an overview and examples of working with sorting data in Molten UIs.

Overview

To sort data received from the leverege api, when requesting a list of devices, we provide an Imagine Sort to the api. The sort informs the api the properties to sort the data on, in addition to the order that they should appear in. Leverege’s sort is backed by elasticsearch and supports relevant query operations.
The Imagine Sort is a plain JSON object that encodes the query structure. The following sort will sort the devices based off of the field specified, in the order specified.
[
{
field : 'data.company.name',
order : 'asc'
}
]
Sorts can be performed along an interface path to sort the response data based off of the information included in the sort.
Sort Types
Name
Decription
Keys
Key Type
Key Description
Default Value
Default Sort
2
Filters the specified field in the specified order
2
field
string
The field that will be sorted against
order
‘asc’ or ‘desc’
The order that the data will be returned in
Geodistance Sort
6
Filters the specified field based off of its distance from the provided point
6
type
‘geoDistance’
specifies the geoDistance sort will be used
field
string
The field that will be sorted against
order
‘asc’ or ‘desc’
The order that the data will be returned in
‘asc’
point
object
GeoPoint that will be used as the reference for the sort
point.lat
float
The Geopoints latitude
point.lng
float
The Geopoints longitude
AttributeSortModel

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.