### 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
private int size;
    /**
     * A geo_line representing the bucket for a {@link GeoLineAggregationBuilder}. The values of <code>line</code> and <code>sortVals</code>
     * are expected to be sorted using <code>sortOrder</code>.
     *
     * @param name            the name of the aggregation
     * @param line            the ordered geo-points representing the line
     * @param sortVals        the ordered sort-values associated with the points in the line (e.g. timestamp)
     * @param metadata        the aggregation's metadata
     * @param complete        true iff the line is representative of all the points that fall within the bucket. False otherwise.
     * @param includeSorts    true iff the sort-values should be rendered in xContent as properties of the line-string. False otherwise.
     * @param sortOrder       the {@link SortOrder} for the line. Whether the points are to be plotted in asc or desc order
     * @param size            the max length of the line-string.
     */
    InternalGeoLine(
        String name,
        long[] line,
        double[] sortVals,
        Map<String, Object> metadata,
        boolean complete,
        boolean includeSorts,
        SortOrder sortOrder,
        int size
    ) {
        super(name, metadata);
        this.line = line;
        this.sortVals = sortVals;
        this.complete = complete;
        this.includeSorts = includeSorts;
        this.sortOrder = sortOrder;