How could I sort resultset not by first item?

Hello,
How could I sort resultset not by first item?
For example:
Query
GET /Organization?_sort=type
Returns me list of resorces sorted by first item of “type”.

  • resource:
    name: Org#1
    type:

    • coding:
      • {code: organization_type#1, system: ‘xxxxxxxxxxxxxxxx’, display: orgs#1}
    • coding:
      • {code: pro#1, system: ‘xxxxxxxxxxxxxxx’, display: pro}
        resourceType: Organization
        -----------------etc-------------------------------
  • resource:
    name: Org#2
    type:

    • coding:
      • {code: organization_type#2, system: xxxxxxxxxxxxxxxxxx’, display: orgs#2}
    • coding:
      • {code: pro#2, system: ‘xxxxxxxxxxxxxxxxx’, display: pro#2}
        resourceType: Organization
        -----------------etc-------------------------------

How could I sort result by second item?
Thanks.

First, there’s no guaranteed ordering to codings within a CodeableConcept - and it’s non-conformant to assert a meaning to the order. So sorting by first vs. second isn’t reliable. Second, the sort isn’t always be grabbing the first. Instead it’s grabbing the repetition with the earliest short order, which, in this case just happens to coincidentally be the first one. If you want to sort on only the Organization types from a specific code system, you’d actually have to define a custom search criteria that limited to only the codes from that code system. Sorting on that search criteria would then sort based on the code from that code system - regardless of the order the codings appear in the instance.