Sort nested field with two conditions

Here is what my mapping looks like:

Elasticsearch version 5.5

{
  "myindex": {
    "mappings": {
      "mythings": {
        "properties": {
          "title": {
            "type": "text"
          },
          "custom_labels": {
            "type": "nested",
            "properties": {
              "label": {
                "type": "keyword"
              },
              "label_group": {
                "type": "keyword"
              },
              "label_group_id": {
                "type": "integer"
              },
              "label_id": {
                "type": "integer"
              }
            }
          }
        }
      }
    }
  }
}

And the data looks like this:

{
  "_source": {
    "title": "The data of the sun",
    "custom_labels": [
      "label": "Green spike",
      "label_group": "spikes",
      "label_group_id": 52,
      "label_id": 9
    ]
  },
  "_source": {
    "title": "Another day",
    "custom_labels": [
      "label": "Apple spike",
      "label_group": "spikes",
      "label_group_id": 52,
      "label_id": 25
    ]
  },
  "_source": {
    "title": "Day five",
    "custom_labels": [
      "label": "Tread",
      "label_group": "tires",
      "label_group_id": 45,
      "label_id": 1
    ]
  }
}

I would like to sort the list by saying:

label_group === "spikes" AND sort by "label" in ascending order

so the result would be:

{
    "_source": {
    "title": "Another day",
    "custom_labels": [
      "label": "Apple spike",
      "label_group": "spikes",
      "label_group_id": 52,
      "label_id": 25
    ]
  },
  "_source": {
    "title": "The data of the sun",
    "custom_labels": [
      "label": "Green spike",
      "label_group": "spikes",
      "label_group_id": 52,
      "label_id": 9
    ]
  },
  "_source": {
    "title": "Day five",
    "custom_labels": [
      "label": "Tread",
      "label_group": "tires",
      "label_group_id": 45,
      "label_id": 1
    ]
  }
}

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