### Elasticsearch Version

master

### Installed Plugins

_No response_

### Java Version

_bundled_

### OS Version

all

### Problem Description

cat indices API in time_series mode is NPE, The reproduce steps is below:

### Steps to Reproduce

```
# step 1
PUT _index_template/test
{
  "index_patterns": [
    "test"
  ],
  "template": {
    "settings": {
      "index.routing_path": "foo"
    },
    "mappings": {
      "properties": {
        "foo": {
          "type": "keyword",
          "time_series_dimension": true
        }
      }
    }
  },
  "data_stream": {
    "index_mode": "time_series"
  }
}

# step 2
PUT _data_stream/test

# step 3
GET _cluster/state/metadata/test
GET _cat/indices/test?v
```
server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
);
        }
        if (indices.size() == (backingIndexPosition + 1)) {
            throw new IllegalArgumentException(
                String.format(
                    Locale.ROOT,
                    "cannot remove backing index [%s] of data stream [%s] because it is the write index",
                    index.getName(),
                    name
                )
            );
        }
        List<Index> backingIndices = new ArrayList<>(indices);
        backingIndices.remove(index);
        assert backingIndices.size() == indices.size() - 1;
        return new DataStream(name, backingIndices, generation + 1, metadata, hidden, replicated, system, allowCustomRouting, indexMode);
    }
    /**
     * Replaces the specified backing index with a new index and returns a new {@code DataStream} instance with
     * the modified backing indices. An {@code IllegalArgumentException} is thrown if the index to be replaced
     * is not a backing index for this data stream or if it is the {@code DataStream}'s write index.
     *
     * @param existingBackingIndex the backing index to be replaced
     * @param newBackingIndex      the new index that will be part of the {@code DataStream}
     * @return new {@code DataStream} instance with backing indices that contain replacement index instead of the specified
     * existing index.
     */
    public DataStream replaceBackingIndex(Index existingBackingIndex, Index newBackingIndex) {
        List<Index> backingIndices = new ArrayList<>(indices);
        int backingIndexPosition = backingIndices.indexOf(existingBackingIndex);