aws-sdk-js icon indicating copy to clipboard operation
aws-sdk-js copied to clipboard

Make searchIndex sortable in IoT

Open icsaba opened this issue 3 years ago • 4 comments

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

icsaba avatar Feb 19 '22 13:02 icsaba

I have to agree, once you exposed maxResults it really begs for a a sort api to be useful.

szabadkai avatar Feb 20 '22 09:02 szabadkai

I agree with the above statement. I can't think of a case where maxResults is useful without sortBy being implemented

kylewatkins1202 avatar Jun 22 '22 20:06 kylewatkins1202

Yes, this is a much-needed feature.

hrsvrma avatar Sep 28 '22 13:09 hrsvrma

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.

e-g-hategan avatar Jul 31 '23 08:07 e-g-hategan