### Elasticsearch Version

all supported versions

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

MacOSX (Darwin Kernel Version 22.3.0 arm64)

### Problem Description

The [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-geo-line.html) for `geo_line` claims that the option `sort_order` can be either `ASC` (default) or `DESC`:

>This option accepts one of two values: "ASC", "DESC".
>The line is sorted in ascending order by the sort key when set to "ASC", and in descending with "DESC".

However, when testing this, no matter which you choose the actual order of points in the result is always `ASC` by the value of the `sort` field.

### Steps to Reproduce

Create an index with a geo_point and a 

```
PUT /locations
{
  "mappings": {
    "properties": {
      "location":    { "type": "geo_point" },
      "rank":  { "type": "double"  }
    }
  }
}
```

Add data with appropriate rank values:

```
POST /locations/_bulk?refresh
{"index":{}}
{"location": [13.37139831, 47.82930284], "rank": 2.0 }
{"index":{}}
{"location": [13.3784208402, 47.88832084022], "rank": 0.0 }
{"index":{}}
{"location": [13.371830148701, 48.2084200148], "rank": 1.2 }
```

Query with `ASC` sort order:

```
POST /locations/_search?filter_path=aggregations
{
  "aggs": {
    "line": {
      "geo_line": {
        "point": {"field": "location"},
        "sort": {"field": "rank"},
        "include_sort": true,
        "sort_order": "ASC"
      }
    }
  }
}
```

And get expected result:

```
{
  "aggregations": {
    "line": {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [
          [
            13.378421,
            47.888321
          ],
          [
            13.37183,
            48.20842
          ],
          [
            13.371398,
            47.829303
          ]
        ]
      },
      "properties" : {
        "complete" : true,
        "sort_values": [0.0, 1.2, 2.0]
      }
    }
  }
}
```

Query with `DESC` sort order:

```
POST /locations/_search?filter_path=aggregations
{
  "aggs": {
    "line": {
      "geo_line": {
        "point": {"field": "location"},
        "sort": {"field": "rank"},
        "include_sort": true,
        "sort_order": "DESC"
      }
    }
  }
}
```

But you get exactly the same result as the previous query. However, we expect the sort order to have been reversed and we expect the following result instead:

```
{
  "aggregations": {
    "line": {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [
          [
            13.371398,
            47.829303
          ],
          [
            13.37183,
            48.20842
          ],
          [
            13.378421,
            47.888321
          ]
        ]
      },
      "properties" : {
        "complete" : true,
        "sort_values": [2.0, 1.2, 0.0]
      }
    }
  }
}
```


### Logs (if relevant)

_No response_
x-pack/plugin/spatial/src/main/java/org/elasticsearch/xpack/spatial/search/aggregations/InternalGeoLine.java
builder.endObject();
        return builder;
    }
    private double roundDegrees(double degree) {
        return Math.round(degree * SCALE) / SCALE;
    }
    @Override
    public Object getProperty(List<String> path) {
        if (path.isEmpty()) {
            return this;
        } else if (path.size() == 1 && "value".equals(path.get(0))) {
            return line;
        } else {
            throw new IllegalArgumentException("path not supported for [" + getName() + "]: " + path);
        }
    }
    @Override
    public String toString() {
        return Strings.toString(this);
    }
    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), Arrays.hashCode(line), Arrays.hashCode(sortVals), complete, includeSorts, sortOrder, size);
    }
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        if (super.equals(obj) == false) return false;
        InternalGeoLine that = (InternalGeoLine) obj;