How to sort and filter data

so i have this data Collection with index of like this

         {
            name: "ref_timelines_reverse_by_user",
             serialized: true,
            source: "timelines",
           terms: [
           {
             field: ["data", "user"]
          }
          ],
         values: [
        {
         field: ["ref"]
        },
        {
         field: ["data", "created"],
         reverse: true
         }
       ]
       }

the result as like bellow

but it should not be like that, because the created is reverse so it should the one with number 164…1193 should be the first

can anyone help me how to query sorted indexed or how to get search result and sort it?

Thanks

Arif

1 Like

I think the way you have it setup, it’s sorting by Reference, and then createAt in descending order. You should try changing the values to look like this instead:

[
  {
    field: ["data", "created"],
    reverse: true
  },
  {
    field: ["ref"]
  }
]

That will get them sorted by createdAt in descending order (and then by Reference, which you can ignore), which is what I’m guessing you want.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.