Getting nested document in sorted order

Suppose I have following mapping.

mappings:
  grocery_store:
    properties:
      business_id:
        type: integer
        store: true
    fruits:
      type: nested
      properties:
        name:
          type: string
          store: true
          index: not_analyzed
        price:
          type: double
          store: true
        weight:
          type: double
          store: true

Suppose I want to get list of fruits of a specific grocery store (i already know the business_id) ordered by the price of the fruit. Is such query possible?
Also, the nested document fruit may have more properties in the future and I would want to get list of the fruit of specific grocery store, ordered by more complicated logic, leveraging on elastic search engine.
I've seen a lot of documentation on how to order grocery_store by aggregate value of nested items, but I haven't seen what I want although it seems to be simpler than the prior.

This isn't possible, elasticsearch uses documents as a basic piece of information, it cannot do much at the field level.

1 Like