Including geo_distance as one of multiple sort clauses

new to this forum, running engineering at a startup which is using OpenSearch in AWS for our search engine, version 2.7 right this minute.
i am trying to get a sort by relevance score, and then distance when there are multiple identical relevance scores. it’s not really working, and i’m not sure what to do next. the online docs don’t say it can do this, but they don’t say it can’t and offer no examples, so i just tried it. the order by relevance score is ok, the distance order is not.

i don’t know if i missed something or this is simply not expected to work. i’m prepared to do the distance sort outside of OpenSearch if i need to. please advise.

this is the sort clause from my Laravel (php) code:

        $query
                .= ',
                "sort": [
                    {
                        "_score": {
                          "order" : "desc"
                        }
                    },
                    {
                        "_geo_distance": {
                        "location.location":  {
                          "lon": ' . floatval($searchLocation['lng']) . ',
                          "lat": ' . floatval($searchLocation['lat']) . '
                        },
                        "order": "asc",
                        "unit": "mi",
                        "distance_type": "plane",
                        "mode": "min",
                        "ignore_unmapped": true
                      }
                    }
                  ]';

This works for me.

Index mapping

{
        "settings" : {
            "number_of_shards": 1,
            "number_of_replicas": 0
        },
        "mappings" : {
            "properties": {
                "title": {
                    "type": "text"
                },
                "point": {
                    "type": "geo_point"
                }
            }
        }
    }

Example documents

{
        "title": "abc",
        "point": "12,12"
}
{
        "title": "abc",
        "point": "13,12"
}
{
        "title": "abc",
        "point": "14,12"
}
{
    "title": "abc aeg",
    "point": "14,12"
}

Search query

{
"query": {
        "match": {
            "title": "abc"
        }
    },
	"sort": [
		{
			"_score": {
				"order": "desc"
			}
		},
    {
      "_geo_distance": {
        "point": { 
          "lat": 14,
          "lon": 12
        },
        "order":         "asc",
        "unit":          "mi", 
        "distance_type": "plane",
				"mode": "min",
				"ignore_unmapped": true
      }
    }
	]
}

Result

{
	"took": 6,
	"timed_out": false,
	"_shards": {
		"total": 1,
		"successful": 1,
		"skipped": 0,
		"failed": 0
	},
	"hits": {
		"total": {
			"value": 4,
			"relation": "eq"
		},
		"max_score": null,
		"hits": [
			{
				"_index": "sort_index",
				"_id": "5cUNZ4oBbrIX9KB0QkVb",
				"_score": 0.11474907,
				"_source": {
					"title": "abc",
					"point": "14,12"
				},
				"sort": [
					0.11474907,
					3.992785297990816E-6
				]
			},
			{
				"_index": "sort_index",
				"_id": "5MUNZ4oBbrIX9KB0QkVW",
				"_score": 0.11474907,
				"_source": {
					"title": "abc",
					"point": "13,12"
				},
				"sort": [
					0.11474907,
					69.09342068113193
				]
			},
			{
				"_index": "sort_index",
				"_id": "48UNZ4oBbrIX9KB0QkVP",
				"_score": 0.11474907,
				"_source": {
					"title": "abc",
					"point": "12,12"
				},
				"sort": [
					0.11474907,
					138.18683872398503
				]
			},
			{
				"_index": "sort_index",
				"_id": "5sUNZ4oBbrIX9KB0QkVg",
				"_score": 0.08459602,
				"_source": {
					"title": "abc aeg",
					"point": "14,12"
				},
				"sort": [
					0.08459602,
					3.992785297990816E-6
				]
			}
		]
	}
}

thanks for replying.
the only difference i can see between mine, that doesn’t seem to work, and yours, is how the geo_point appears in the template. i see in our search return that the distance is correctly computed, but the order we’re getting back from opensearch is wrong.