aws-sdk-js
aws-sdk-js copied to clipboard
Make searchIndex sortable in IoT
Confirm by changing [ ] to [x] below:
- [x] This is a feature with version 2.x of the SDK
Is your feature request related to a problem? Please describe.
We are trying to build up a dashboard using IoT without databases, because IoT provides all of the features we need (fleet indexing, basic pagination etc...), except sorting. Currently i have to use 4 different searchIndex
api call to get what i want.
One for connected devices, one for the rest, one for a query based on a shadow property, and one for the rest, and it just gets more complicated when we have to use pagination.
Describe the solution you'd like
Extending the searchIndex
method with a sortBy
property, where you can define how you would like to sort the data, and it should work with pagination as well.
Examples:
iot.searchIndex({
indexName: INDEX_NAME,
queryString: 'thingTypeName:"xyz" AND ...',
nextToken: NEXT_TOKEN,
maxResults: 25,
sortBy: 'connectivity.connected desc AND shadow.reported.someProp asc'
})
The format of sortBy
does not really matter.
Describe alternatives you've considered
Additional context
I have to agree, once you exposed maxResults it really begs for a a sort api to be useful.
I agree with the above statement. I can't think of a case where maxResults is useful without sortBy being implemented
Yes, this is a much-needed feature.
I am also missing such a feature. What is the typical workaround for this? Storing the sortable fields in a database for the list view? That's not good enough in our case because some of these fields are shadow properties or connectivity data which do change with time. I'm already using dynamic thing groups for filtering but they are not useful for sorting.