Sorting on multi-level nested documents

I have the following mapping, which has two levels of nested documents. The first nested document is Parties, and within Parties are nested documents; Details.

I am trying to sort on Parties.Details.Value and that works perfectly.

I can filter the sort so that I only sort on Parties.Details.Value where Parties.Details.Key = "propertyNumber" and that works fine.

Where I am failing is where I want to sort on Parties.Details.Value where Parties.Key = "shipper" AND Parties.Details.Key = "propertyNumber".

{
  "mappings": {
    "transactionentity": {
      "properties": {
        "EditedBy": {
          "type": "string"
        },
        "EditedDate": {
          "type": "date"
        },
        "Id": {
          "type": "integer"
        },
        "Parties": {
          "properties": {
            "Key": {
              "type": "string"
            },
            "Name": {
              "type": "string"
            },
            "Details": {
              "properties": {
                "Unit": {
                  "type": "string"
                },
                "Key": {
                  "type": "string"
                },
                "Value": {
                  "type": "string"
                }
              },
              "type": "nested"
            }
          },
          "type": "nested"
        }
      }
    }
  }
}

This sort clause works:

  "sort": [
    {
      "Parties.Details.Value": {
        "order": "asc",
        "nested_filter": {
          "term": {
            "Parties.Details.Key": "propertyNumber"
          }
        }
      }
    }

I have tried many variations on nested filters for the "nested_filter" but have had no luck. Variations like below result in "Infinity" as the search value.

"sort": [
    {
      "Parties.Details.Value": {
        "mode": "min",
        "order": "asc",
        "nested_filter": {
          "bool": {
            "must": [
              {
                "nested": {
                  "filter": {
                    "bool": {
                      "must": [
                        {
                          "term": {
                            "Parties.Key": "shipper"
                          }
                        },
                        {
                          "nested": {
                            "filter": {
                              "term": {
                                "Parties.Details.Key": "propertyNumber"
                              }
                            },
                            "path": "Parties.Details"
                          }
                        }
                      ]
                    }
                  },
                  "path": "Parties"
                }
              }
            ]
          }
        }
      }
    }

This is the only thing stopping us from going into production and any help would be GREATLY appreciated.

Hi @huwkthomas,

We are having this same issue and we can't make it. Did you finally resolve it?

Thanks