You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "iprithv (via GitHub)" <gi...@apache.org> on 2026/09/26 23:12:55 UTC

[PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

iprithv opened a new pull request, #4952:
URL: https://github.com/apache/solr/pull/4952

   https://issues.apache.org/jira/browse/SOLR-18450
   
   GET /api/cluster is a typed jax-rs api now. with no params it still returns every collection, under cluster.collections. shards, replicas, health, config name, and the usual replica fields (node_name, base_url, core, type, leader) are typed. the rest of the state.json fields stay too: router, replica counts, user properties, and per-replica state when prs=true. leader is still the string "true", same as state.json.
   
   live nodes, the alias map, and cluster properties are off this payload. those live on GET /api/cluster/nodes, GET /api/aliases, and GET /api/cluster/properties. includeall, livenodes, aliases, and clusterproperties are ignored if a caller still sends them. collection, shard, and route still narrow the tree.
   
   each collection still lists the aliases that point at it, since the collections screen shows that list.
   
   v1 clusterstatus is unchanged, and includeall still defaults to true. POST /api/cluster is unchanged.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4952:
URL: https://github.com/apache/solr/pull/4952#issuecomment-5995575552

   This should also close https://issues.apache.org/jira/browse/SOLR-17422 !


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139228372


##########
solr/webapp/web/js/angular/services.js:
##########
@@ -162,10 +162,9 @@ solrAdminServices.factory('Metrics',
     })
 .factory('Collections',
   ['$resource', function ($resource) {
-    // v2 ClusterAPI (/api/cluster) delegates straight through to the same v1 CollectionsHandler
-    // that v1's CLUSTERSTATUS action used, so the response shape is byte-identical -- no
-    // generated solrApi client class exists for it (old-style @EndPoint API, predates the
-    // OpenAPI-based v2 framework), so this stays a plain $resource, like Threads/ParamSet.
+    // GET /api/cluster returns {cluster: {collections: ...}}, the collections, shards, and
+    // replicas tree. Live nodes, the alias map, and cluster properties are not in this payload.
+    // This stays a plain $resource, like Threads/ParamSet.
     return $resource('/api/cluster', {'wt':'json', '_':Date.now()}, {

Review Comment:
   ClusterApi.getClusterStatus is generated now (tag cluster)
   ClusterV2 already wraps solrApi.ClusterApi...the call sites still use Collections.status(...) with the $resource callback shape (data.cluster.collections), so switching means rewriting those controllers to the error-first generated client style. can we do that as follow-up rather than expanding this PR?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139207716


##########
solr/solr-ref-guide/modules/deployment-guide/pages/cluster-node-management.adoc:
##########
@@ -148,7 +165,7 @@ The response will include the status of the request and the status of the cluste
 http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS
 ----
 
-*Output*
+*V1 output*

Review Comment:
   actually no, reverted!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4113855812


##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetClusterStatus.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import jakarta.inject.Inject;
+import java.util.Map;
+import org.apache.solr.client.api.endpoint.GetClusterStatusApi;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.ShardParams;
+import org.apache.solr.common.util.CollectionUtil;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.admin.ClusterStatus;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJacksonMapper;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 API for the collections, shards, and replicas tree.
+ *
+ * <p>{@code GET /api/cluster} returns that tree and nothing else hanging off the cluster object.
+ * Live nodes, aliases, and cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS}
+ * is unchanged.
+ */
+public class GetClusterStatus extends AdminAPIBase implements GetClusterStatusApi {
+
+  @Inject
+  public GetClusterStatus(
+      CoreContainer coreContainer, SolrQueryRequest req, SolrQueryResponse rsp) {
+    super(coreContainer, req, rsp);
+  }
+
+  @Override
+  @PermissionName(COLL_READ_PERM)
+  public GetClusterStatusResponse getClusterStatus(
+      String collection, String shard, String routeKey, Boolean prs) throws Exception {
+    final GetClusterStatusResponse response =
+        instantiateJerseyResponse(GetClusterStatusResponse.class);
+    validateZooKeeperAwareCoreContainer(coreContainer);
+    if (collection != null) {
+      recordCollectionForLogAndTracing(collection, solrQueryRequest);
+    }
+
+    // Only the parameters this API documents. includeAll, liveNodes, aliases, and

Review Comment:
   I wish we returned HTTP 400 for all unknown / unsupported params. Since a caller asking for live_nodes won’t get them, so fail fast.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4173955061


##########
solr/core/src/test/org/apache/solr/handler/admin/api/ListCollectionsDetailedStandaloneTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import org.apache.solr.SolrTestCase;
+import org.apache.solr.client.solrj.RemoteSolrException;
+import org.apache.solr.client.solrj.request.CollectionsApi;
+import org.apache.solr.util.SolrJettyTestRule;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+/** Standalone coverage for {@code GET /api/collections?detailed=true}. */

Review Comment:
   okay.   I look forward to the day we remove standalone and just run "single node Solr Cloud" and call it "Solr Mode" ;-)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4113376504


##########
solr/api/src/java/org/apache/solr/client/api/endpoint/GetClusterStatusApi.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.api.endpoint;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.QueryParam;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+
+/**
+ * V2 API definition for the collections, shards, and replicas tree.
+ *
+ * <p>This API ({@code GET /api/cluster}) returns the same collection tree as v1 {@code
+ * CLUSTERSTATUS}. It does not return live nodes, the alias map, or cluster properties. With no

Review Comment:
   i guess this comment about what it doesn't do is fine as we wait to get rid of v1...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4952:
URL: https://github.com/apache/solr/pull/4952#issuecomment-5953900472

   @iprithv this is a big refactor based on @dsmiley feedback on the JIRA and my most recent email on the thread that all of this belongs under /api/collections, and that we actually need something quite different under /api/cluster...   
   
   Thanks for all your hard work on this PR, moving it was pretty easy because of the work you had done!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139176442


##########
solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java:
##########
@@ -143,13 +146,49 @@ public void getClusterStatus(NamedList<Object> results, SolrVersion solrVersion)
     results.add("cluster", clusterStatus);
   }
 
-  private void fetchClusterStatusForCollOrAlias(
+  /**
+   * Collections, shards, and replicas selected by this request's {@code collection}, {@code shard},
+   * and {@code _route_} parameters.
+   *
+   * <p>Live nodes are read so replica state can be cross-checked, and aliases are read so a
+   * collection alias in {@code collection} can be resolved. Each collection still lists the aliases
+   * that point at it. The live-node list, the alias map, and cluster properties are not returned.
+   */
+  public Map<String, Object> getCollectionStatuses() throws KeeperException, InterruptedException {
+    List<String> liveNodes =
+        zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null);
+    Aliases aliases = zkStateReader.getAliases();
+    Map<String, Object> collections = new LinkedHashMap<>();
+    forEachCollectionStatus(
+        liveNodes, aliases, (name, status) -> collections.put(name, copyForJackson(status)));
+    return collections;
+  }
+
+  private void addCollectionStatuses(
       NamedList<Object> clusterStatus,
       List<String> liveNodes,
       Aliases aliases,
       SolrVersion solrVersion) {
+    // Resolve the collection list now so a missing name fails the request, rather than during
+    // response writing. The per-collection JSON is still built while the response is written.
+    PreparedCollections prepared = prepareCollections(aliases);
+    if (solrVersion == null || solrVersion.greaterThanOrEqualTo(SolrVersion.valueOf("9.9.0"))) {

Review Comment:
   thsi is pre-existing, from SOLR-17582.. it streams collections as a MapWriter for SolrJ 9.9+, and falls back to a NamedList for older clients. not a rolling-upgrade feature of this change... just left that path alone.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4217363064


##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########


Review Comment:
   Two things:
   
   1. Neither the upgrade note nor the changelog says that `GET /api/cluster` no longer exists. Even if we declare V2 as experimental, we can call it out in upgrade notes when an entire API is **removed**.
   2. If we decide to backport to 10.2, the release note must move to `...-in-solr-10.adoc`, and we could also consider adding in a (deprecated) shim `GET /api/cluster` endpoint calling `/api/collections`. Since SolrOperator uses V1 for clusterstatus, I don't think such a shim is crucial though



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #4952:
URL: https://github.com/apache/solr/pull/4952#issuecomment-5995561682

   Going to merge on Tuesday oct 6th...  I've emailed the dev thread to ask for final review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4221404057


##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########


Review Comment:
   I do want it on branch_10x to land in 10.2.   What is the best approach for moving the content?  Should I make the change on this PR that has been merged already?   Should I do another sepeate PR to move the content to `-in-solr-10.adoc`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139194766


##########
solr/core/src/test/org/apache/solr/handler/admin/api/GetClusterStatusTest.java:
##########
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.ReplicaState;
+import org.apache.solr.client.solrj.SolrRequest.SolrRequestType;
+import org.apache.solr.client.solrj.request.ClusterApi;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.GenericSolrRequest;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.Utils;
+import org.eclipse.jetty.client.ContentResponse;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * HTTP tests for {@code GET /api/cluster}.
+ *
+ * <p>The response is the collections, shards, and replicas tree. Live nodes, the alias map, and
+ * cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS} still returns them.
+ */
+public class GetClusterStatusTest extends SolrCloudTestCase {
+
+  private static final String COLLECTION = "clusterstatuscoll";
+  private static final String ALIAS = "clusterstatusalias";
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", configset("cloud-minimal")).configure();
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", 1, 1)
+        .process(cluster.getSolrClient());
+    CollectionAdminRequest.createAlias(ALIAS, COLLECTION).process(cluster.getSolrClient());
+  }
+
+  @Test
+  public void testReturnsCollectionTreeWithoutClusterLevelExtras() throws Exception {
+    Map<String, Object> clusterState = clusterObject(getCluster(""));
+    assertNull(clusterState.get("live_nodes"));
+    assertNull(clusterState.get("aliases"));
+    assertNull(clusterState.get("properties"));
+
+    Map<String, Object> collection = collection(clusterState, COLLECTION);
+    assertNotNull(collection.get("health"));
+    assertEquals("conf", collection.get("configName"));
+    assertNotNull(collection.get("router"));
+    assertEquals(Set.of("shard1"), shards(collection).keySet());
+    assertNotNull(replica(collection).get("node_name"));
+    assertNotNull(replica(collection).get("state"));
+    assertTrue(aliasesOf(collection).contains(ALIAS));
+  }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testGeneratedClientReadsTheTree() throws Exception {
+    GetClusterStatusResponse response =
+        new ClusterApi.GetClusterStatus().process(cluster.getSolrClient());
+    assertNull(response.error);
+    CollectionState collection = response.cluster.collections.get(COLLECTION);
+    assertNotNull(collection);
+    assertEquals("conf", collection.configName);
+    assertNotNull(collection.health);
+    assertTrue(collection.aliases.contains(ALIAS));
+    Map<String, Object> router = (Map<String, Object>) collection.unknownProperties().get("router");
+    assertEquals("compositeId", router.get("name"));
+
+    ReplicaState replica = collection.shards.get("shard1").replicas.values().iterator().next();
+    assertNotNull(replica.nodeName);
+    assertNotNull(replica.state);
+    assertEquals("true", replica.leader);
+  }
+
+  @Test
+  public void testV1SelectionParamsAreIgnored() throws Exception {
+    Map<String, Object> clusterState =
+        clusterObject(
+            getCluster("?liveNodes=true&aliases=true&clusterProperties=true&includeAll=true"));
+    assertNull(clusterState.get("live_nodes"));

Review Comment:
   yes, we ignore... undeclared query params don’t bind on the jax-rs method, and we don’t read them from the raw request either. jersey’s usual default is to ignore unknown query params; blowing up would need an explicit policy (bean validation / filter) across v2.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139185163


##########
solr/core/src/java/org/apache/solr/handler/ClusterAPI.java:
##########
@@ -210,13 +208,6 @@ public static SolrQueryRequest wrapParams(SolrQueryRequest req, Map<String, Obje
     return req;
   }
 
-  @EndPoint(method = GET, path = "/cluster", permission = COLL_READ_PERM)

Review Comment:
   no registerV2 on this class :) only removed old GET /cluster @ EndPoint that forwarded to v1 CLUSTERSTATUS. kept POST /cluster (set-ratelimiter).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on PR #4952:
URL: https://github.com/apache/solr/pull/4952#issuecomment-5957094610

    makes sense putting the tree under collections.. looks good!
   
   +1


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139228372


##########
solr/webapp/web/js/angular/services.js:
##########
@@ -162,10 +162,9 @@ solrAdminServices.factory('Metrics',
     })
 .factory('Collections',
   ['$resource', function ($resource) {
-    // v2 ClusterAPI (/api/cluster) delegates straight through to the same v1 CollectionsHandler
-    // that v1's CLUSTERSTATUS action used, so the response shape is byte-identical -- no
-    // generated solrApi client class exists for it (old-style @EndPoint API, predates the
-    // OpenAPI-based v2 framework), so this stays a plain $resource, like Threads/ParamSet.
+    // GET /api/cluster returns {cluster: {collections: ...}}, the collections, shards, and
+    // replicas tree. Live nodes, the alias map, and cluster properties are not in this payload.
+    // This stays a plain $resource, like Threads/ParamSet.
     return $resource('/api/cluster', {'wt':'json', '_':Date.now()}, {

Review Comment:
   ClusterApi.getClusterStatus is generated now (tag cluster)
   ClusterV2 already wraps solrApi.ClusterApi...the call sites still use Collections.status(...) with the $resource callback shape (data.cluster.collections), so switching means rewriting those controllers to the error-first generated client style. can we do that as follow-up?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4113416798


##########
solr/webapp/web/js/angular/services.js:
##########
@@ -162,10 +162,9 @@ solrAdminServices.factory('Metrics',
     })
 .factory('Collections',
   ['$resource', function ($resource) {
-    // v2 ClusterAPI (/api/cluster) delegates straight through to the same v1 CollectionsHandler
-    // that v1's CLUSTERSTATUS action used, so the response shape is byte-identical -- no
-    // generated solrApi client class exists for it (old-style @EndPoint API, predates the
-    // OpenAPI-based v2 framework), so this stays a plain $resource, like Threads/ParamSet.
+    // GET /api/cluster returns {cluster: {collections: ...}}, the collections, shards, and
+    // replicas tree. Live nodes, the alias map, and cluster properties are not in this payload.
+    // This stays a plain $resource, like Threads/ParamSet.
     return $resource('/api/cluster', {'wt':'json', '_':Date.now()}, {

Review Comment:
   COuldn't we just use the strongly type JS object here?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4223198134


##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########


Review Comment:
   New followup PR



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh merged PR #4952:
URL: https://github.com/apache/solr/pull/4952


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4113387706


##########
solr/core/src/java/org/apache/solr/handler/admin/ClusterStatus.java:
##########
@@ -143,13 +146,49 @@ public void getClusterStatus(NamedList<Object> results, SolrVersion solrVersion)
     results.add("cluster", clusterStatus);
   }
 
-  private void fetchClusterStatusForCollOrAlias(
+  /**
+   * Collections, shards, and replicas selected by this request's {@code collection}, {@code shard},
+   * and {@code _route_} parameters.
+   *
+   * <p>Live nodes are read so replica state can be cross-checked, and aliases are read so a
+   * collection alias in {@code collection} can be resolved. Each collection still lists the aliases
+   * that point at it. The live-node list, the alias map, and cluster properties are not returned.
+   */
+  public Map<String, Object> getCollectionStatuses() throws KeeperException, InterruptedException {
+    List<String> liveNodes =
+        zkStateReader.getZkClient().getChildren(ZkStateReader.LIVE_NODES_ZKNODE, null);
+    Aliases aliases = zkStateReader.getAliases();
+    Map<String, Object> collections = new LinkedHashMap<>();
+    forEachCollectionStatus(
+        liveNodes, aliases, (name, status) -> collections.put(name, copyForJackson(status)));
+    return collections;
+  }
+
+  private void addCollectionStatuses(
       NamedList<Object> clusterStatus,
       List<String> liveNodes,
       Aliases aliases,
       SolrVersion solrVersion) {
+    // Resolve the collection list now so a missing name fails the request, rather than during
+    // response writing. The per-collection JSON is still built while the response is written.
+    PreparedCollections prepared = prepareCollections(aliases);
+    if (solrVersion == null || solrVersion.greaterThanOrEqualTo(SolrVersion.valueOf("9.9.0"))) {

Review Comment:
   huh....   is this part of a rolling upgrade feature?



##########
solr/core/src/java/org/apache/solr/handler/ClusterAPI.java:
##########
@@ -210,13 +208,6 @@ public static SolrQueryRequest wrapParams(SolrQueryRequest req, Map<String, Obje
     return req;
   }
 
-  @EndPoint(method = GET, path = "/cluster", permission = COLL_READ_PERM)

Review Comment:
   is there also a registerV2 Api method on this guy which can be removed?



##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetClusterStatus.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import jakarta.inject.Inject;
+import java.util.Map;
+import org.apache.solr.client.api.endpoint.GetClusterStatusApi;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.ShardParams;
+import org.apache.solr.common.util.CollectionUtil;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.admin.ClusterStatus;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJacksonMapper;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 API for the collections, shards, and replicas tree.
+ *
+ * <p>{@code GET /api/cluster} returns that tree and nothing else hanging off the cluster object.
+ * Live nodes, aliases, and cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS}
+ * is unchanged.
+ */
+public class GetClusterStatus extends AdminAPIBase implements GetClusterStatusApi {
+
+  @Inject
+  public GetClusterStatus(
+      CoreContainer coreContainer, SolrQueryRequest req, SolrQueryResponse rsp) {
+    super(coreContainer, req, rsp);
+  }
+
+  @Override
+  @PermissionName(COLL_READ_PERM)
+  public GetClusterStatusResponse getClusterStatus(
+      String collection, String shard, String routeKey, Boolean prs) throws Exception {
+    final GetClusterStatusResponse response =
+        instantiateJerseyResponse(GetClusterStatusResponse.class);
+    validateZooKeeperAwareCoreContainer(coreContainer);
+    if (collection != null) {
+      recordCollectionForLogAndTracing(collection, solrQueryRequest);
+    }
+
+    // Only the parameters this API documents. includeAll, liveNodes, aliases, and

Review Comment:
   yeah, not sure we should still be documenting the includeAll and liveNodes etc at this level.  One comment, okay, but seems like too many



##########
solr/solr-ref-guide/modules/deployment-guide/pages/cluster-node-management.adoc:
##########
@@ -148,7 +165,7 @@ The response will include the status of the request and the status of the cluste
 http://localhost:8983/solr/admin/collections?action=CLUSTERSTATUS
 ----
 
-*Output*
+*V1 output*

Review Comment:
   do we need a seperate v2 api output?



##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########
@@ -41,3 +41,21 @@ bin/solr start -Dsolr.node.roles=data:on,overseer:preferred
 
 A node started this way asks the Overseer to re-run its node prioritization, so a preferred node takes over without waiting for the current Overseer to restart.
 Note that node roles are fixed for the lifetime of a node: unlike `ADDROLE`, they cannot be changed on a running node.
+
+=== V2 cluster status
+
+`GET /api/cluster` is now a typed API.

Review Comment:
   this may get backported to solr 10, and honestly, since we are changing v1, i don't know if this ends up being a major change?   since i don't think it's widely used yet?



##########
solr/core/src/test/org/apache/solr/handler/admin/api/GetClusterStatusTest.java:
##########
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.ReplicaState;
+import org.apache.solr.client.solrj.SolrRequest.SolrRequestType;
+import org.apache.solr.client.solrj.request.ClusterApi;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.GenericSolrRequest;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.Utils;
+import org.eclipse.jetty.client.ContentResponse;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * HTTP tests for {@code GET /api/cluster}.
+ *
+ * <p>The response is the collections, shards, and replicas tree. Live nodes, the alias map, and
+ * cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS} still returns them.
+ */
+public class GetClusterStatusTest extends SolrCloudTestCase {
+
+  private static final String COLLECTION = "clusterstatuscoll";
+  private static final String ALIAS = "clusterstatusalias";
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", configset("cloud-minimal")).configure();
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", 1, 1)
+        .process(cluster.getSolrClient());
+    CollectionAdminRequest.createAlias(ALIAS, COLLECTION).process(cluster.getSolrClient());
+  }
+
+  @Test
+  public void testReturnsCollectionTreeWithoutClusterLevelExtras() throws Exception {
+    Map<String, Object> clusterState = clusterObject(getCluster(""));
+    assertNull(clusterState.get("live_nodes"));
+    assertNull(clusterState.get("aliases"));
+    assertNull(clusterState.get("properties"));
+
+    Map<String, Object> collection = collection(clusterState, COLLECTION);
+    assertNotNull(collection.get("health"));
+    assertEquals("conf", collection.get("configName"));
+    assertNotNull(collection.get("router"));
+    assertEquals(Set.of("shard1"), shards(collection).keySet());
+    assertNotNull(replica(collection).get("node_name"));
+    assertNotNull(replica(collection).get("state"));
+    assertTrue(aliasesOf(collection).contains(ALIAS));
+  }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testGeneratedClientReadsTheTree() throws Exception {
+    GetClusterStatusResponse response =
+        new ClusterApi.GetClusterStatus().process(cluster.getSolrClient());
+    assertNull(response.error);
+    CollectionState collection = response.cluster.collections.get(COLLECTION);
+    assertNotNull(collection);
+    assertEquals("conf", collection.configName);
+    assertNotNull(collection.health);
+    assertTrue(collection.aliases.contains(ALIAS));
+    Map<String, Object> router = (Map<String, Object>) collection.unknownProperties().get("router");
+    assertEquals("compositeId", router.get("name"));
+
+    ReplicaState replica = collection.shards.get("shard1").replicas.values().iterator().next();
+    assertNotNull(replica.nodeName);
+    assertNotNull(replica.state);
+    assertEquals("true", replica.leader);
+  }
+
+  @Test
+  public void testV1SelectionParamsAreIgnored() throws Exception {
+    Map<String, Object> clusterState =
+        clusterObject(
+            getCluster("?liveNodes=true&aliases=true&clusterProperties=true&includeAll=true"));
+    assertNull(clusterState.get("live_nodes"));

Review Comment:
   wht happens when random params are provided?  do we blow up or do we ignore them?  what is the Jersey "right" answer for that?



##########
solr/solr-ref-guide/modules/configuration-guide/pages/v2-api.adoc:
##########


Review Comment:
   I think we need to double check this page...   do we actually want this level of doc on this page?  every api will be a v2 api, and we have the tabs pattern....    I think maybe we are reducing this page (in another PR?) content to just maybe what is the v2 api and what a user would need to know.



##########
solr/core/src/test/org/apache/solr/handler/admin/api/GetClusterStatusTest.java:
##########
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.ReplicaState;
+import org.apache.solr.client.solrj.SolrRequest.SolrRequestType;
+import org.apache.solr.client.solrj.request.ClusterApi;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.GenericSolrRequest;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.Utils;
+import org.eclipse.jetty.client.ContentResponse;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * HTTP tests for {@code GET /api/cluster}.
+ *
+ * <p>The response is the collections, shards, and replicas tree. Live nodes, the alias map, and
+ * cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS} still returns them.
+ */
+public class GetClusterStatusTest extends SolrCloudTestCase {
+
+  private static final String COLLECTION = "clusterstatuscoll";
+  private static final String ALIAS = "clusterstatusalias";
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", configset("cloud-minimal")).configure();
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", 1, 1)
+        .process(cluster.getSolrClient());
+    CollectionAdminRequest.createAlias(ALIAS, COLLECTION).process(cluster.getSolrClient());
+  }
+
+  @Test
+  public void testReturnsCollectionTreeWithoutClusterLevelExtras() throws Exception {
+    Map<String, Object> clusterState = clusterObject(getCluster(""));
+    assertNull(clusterState.get("live_nodes"));

Review Comment:
   yeah, I suppose!



##########
solr/solr-ref-guide/modules/deployment-guide/pages/cluster-node-management.adoc:
##########
@@ -106,6 +111,9 @@ This can be used if you need the details of the shard where a particular documen
 |Optional |Default: will default to the default value of `includeAll` parameter specified below
 |===
 +
+v1 only.
+If set to true, returns the cluster alias map.
+The v2 API does not return this map; use `GET /api/aliases`.

Review Comment:
   nice!



##########
solr/api/src/java/org/apache/solr/client/api/model/GetClusterStatusResponse.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.api.model;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Response body for {@code GET /api/cluster}.
+ *
+ * <p>Shards, replicas, health, and the other stable collection-state fields are typed. A collection
+ * state document is otherwise open: router settings, replica placement counts, user properties, and
+ * per-replica state are preserved on the object rather than dropped. Live nodes, the alias map, and
+ * cluster properties are not part of this response. Each collection still lists the aliases that
+ * point at it.
+ */
+public class GetClusterStatusResponse extends SolrJerseyResponse {
+
+  @Schema(
+      description =
+          "Cluster geometry. Does not include live nodes, the alias map, or cluster properties.")

Review Comment:
   i think we don't need the the Does Not aspects in the descritiption.  We highlight that int he docs..



##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetClusterStatus.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import jakarta.inject.Inject;
+import java.util.Map;
+import org.apache.solr.client.api.endpoint.GetClusterStatusApi;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.ShardParams;
+import org.apache.solr.common.util.CollectionUtil;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.admin.ClusterStatus;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJacksonMapper;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 API for the collections, shards, and replicas tree.
+ *
+ * <p>{@code GET /api/cluster} returns that tree and nothing else hanging off the cluster object.
+ * Live nodes, aliases, and cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS}
+ * is unchanged.
+ */
+public class GetClusterStatus extends AdminAPIBase implements GetClusterStatusApi {
+
+  @Inject
+  public GetClusterStatus(
+      CoreContainer coreContainer, SolrQueryRequest req, SolrQueryResponse rsp) {
+    super(coreContainer, req, rsp);
+  }
+
+  @Override
+  @PermissionName(COLL_READ_PERM)
+  public GetClusterStatusResponse getClusterStatus(
+      String collection, String shard, String routeKey, Boolean prs) throws Exception {
+    final GetClusterStatusResponse response =
+        instantiateJerseyResponse(GetClusterStatusResponse.class);
+    validateZooKeeperAwareCoreContainer(coreContainer);
+    if (collection != null) {
+      recordCollectionForLogAndTracing(collection, solrQueryRequest);
+    }
+
+    // Only the parameters this API documents. includeAll, liveNodes, aliases, and

Review Comment:
   what happens if you pass them in?  does it get run?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139165973


##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetClusterStatus.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import jakarta.inject.Inject;
+import java.util.Map;
+import org.apache.solr.client.api.endpoint.GetClusterStatusApi;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.ShardParams;
+import org.apache.solr.common.util.CollectionUtil;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.admin.ClusterStatus;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJacksonMapper;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 API for the collections, shards, and replicas tree.
+ *
+ * <p>{@code GET /api/cluster} returns that tree and nothing else hanging off the cluster object.
+ * Live nodes, aliases, and cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS}
+ * is unchanged.
+ */
+public class GetClusterStatus extends AdminAPIBase implements GetClusterStatusApi {
+
+  @Inject
+  public GetClusterStatus(
+      CoreContainer coreContainer, SolrQueryRequest req, SolrQueryResponse rsp) {
+    super(coreContainer, req, rsp);
+  }
+
+  @Override
+  @PermissionName(COLL_READ_PERM)
+  public GetClusterStatusResponse getClusterStatus(
+      String collection, String shard, String routeKey, Boolean prs) throws Exception {
+    final GetClusterStatusResponse response =
+        instantiateJerseyResponse(GetClusterStatusResponse.class);
+    validateZooKeeperAwareCoreContainer(coreContainer);
+    if (collection != null) {
+      recordCollectionForLogAndTracing(collection, solrQueryRequest);
+    }
+
+    // Only the parameters this API documents. includeAll, liveNodes, aliases, and

Review Comment:
   > I wish we returned HTTP 400 for all unknown / unsupported params. Since a caller asking for live_nodes won’t get them, so fail fast.
   
   i’d like that too as a broader jersey/v2 convention :) but i’m leaving it out of this PR. we already walked back a bare-GET 400 because solr-operator and the admin UI both need the full tree with no selector. rejecting the old v1 knobs here would be a one-off, and random undeclared query params are ignored by jersey today the same way. happy to do a follow-up that fails unknown params more widely if we want that policy :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4167502958


##########
solr/core/src/java/org/apache/solr/handler/admin/api/ListCollections.java:
##########
@@ -43,11 +56,31 @@ public ListCollections(CoreContainer coreContainer, SolrQueryRequest req, SolrQu
 
   @Override
   @PermissionName(COLL_READ_PERM)
-  public ListCollectionsResponse listCollections() {
+  public ListCollectionsResponse listCollections(
+      Boolean detailed, String collection, String shard, String routeKey, Boolean prs)
+      throws Exception {
     final ListCollectionsResponse response =
         instantiateJerseyResponse(ListCollectionsResponse.class);
     validateZooKeeperAwareCoreContainer(coreContainer);
 
+    if (Boolean.TRUE.equals(detailed)) {
+      if (collection != null) {
+        recordCollectionForLogAndTracing(collection, solrQueryRequest);
+      }
+      // Bind only the documented query params; anything else on the request is ignored.

Review Comment:
   i suppose this comment is okay.  This is I bleieve the actual default behavior of all v2 aps...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139220188


##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########
@@ -41,3 +41,21 @@ bin/solr start -Dsolr.node.roles=data:on,overseer:preferred
 
 A node started this way asks the Overseer to re-run its node prioritization, so a preferred node takes over without waiting for the current Overseer to restart.
 Note that node roles are fixed for the lifetime of a node: unlike `ADDROLE`, they cannot be changed on a running node.
+
+=== V2 cluster status
+
+`GET /api/cluster` is now a typed API.

Review Comment:
   left it for now. v1 is unchanged.. this is a breaking change for v2 GET /api/cluster consumers (admin UI and solr-operator both read that tree). if we backport to 10 we can move/copy the note. will drop it if we rather keep upgrade notes for more widely used surfaces only?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139202248


##########
solr/solr-ref-guide/modules/configuration-guide/pages/v2-api.adoc:
##########


Review Comment:
   yeah, fair.. i only updated the existing /api/cluster row and the curl example so it matches the real payload. dropped the extra “what’s excluded” prose from this page.. real contract lives on the cluster-node-management page.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139364641


##########
solr/webapp/web/js/angular/services.js:
##########
@@ -162,10 +162,9 @@ solrAdminServices.factory('Metrics',
     })
 .factory('Collections',
   ['$resource', function ($resource) {
-    // v2 ClusterAPI (/api/cluster) delegates straight through to the same v1 CollectionsHandler
-    // that v1's CLUSTERSTATUS action used, so the response shape is byte-identical -- no
-    // generated solrApi client class exists for it (old-style @EndPoint API, predates the
-    // OpenAPI-based v2 framework), so this stays a plain $resource, like Threads/ParamSet.
+    // GET /api/cluster returns {cluster: {collections: ...}}, the collections, shards, and
+    // replicas tree. Live nodes, the alias map, and cluster properties are not in this payload.
+    // This stays a plain $resource, like Threads/ParamSet.
     return $resource('/api/cluster', {'wt':'json', '_':Date.now()}, {

Review Comment:
   i supposed...    one thing is, if you do it here, we can test things out from a UI perspective, and then move it to a seperate PR....



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4167518069


##########
solr/core/src/test/org/apache/solr/handler/admin/api/ListCollectionsDetailedStandaloneTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import org.apache.solr.SolrTestCase;
+import org.apache.solr.client.solrj.RemoteSolrException;
+import org.apache.solr.client.solrj.request.CollectionsApi;
+import org.apache.solr.util.SolrJettyTestRule;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+/** Standalone coverage for {@code GET /api/collections?detailed=true}. */

Review Comment:
   I suppose.   Do we need to test that a cloud feature fails nicely on standalone?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139370957


##########
solr/core/src/test/org/apache/solr/handler/admin/api/GetClusterStatusTest.java:
##########
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.ReplicaState;
+import org.apache.solr.client.solrj.SolrRequest.SolrRequestType;
+import org.apache.solr.client.solrj.request.ClusterApi;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.GenericSolrRequest;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.Utils;
+import org.eclipse.jetty.client.ContentResponse;
+import org.eclipse.jetty.client.HttpClient;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * HTTP tests for {@code GET /api/cluster}.
+ *
+ * <p>The response is the collections, shards, and replicas tree. Live nodes, the alias map, and
+ * cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS} still returns them.
+ */
+public class GetClusterStatusTest extends SolrCloudTestCase {
+
+  private static final String COLLECTION = "clusterstatuscoll";
+  private static final String ALIAS = "clusterstatusalias";
+
+  @BeforeClass
+  public static void setupCluster() throws Exception {
+    configureCluster(1).addConfig("conf", configset("cloud-minimal")).configure();
+    CollectionAdminRequest.createCollection(COLLECTION, "conf", 1, 1)
+        .process(cluster.getSolrClient());
+    CollectionAdminRequest.createAlias(ALIAS, COLLECTION).process(cluster.getSolrClient());
+  }
+
+  @Test
+  public void testReturnsCollectionTreeWithoutClusterLevelExtras() throws Exception {
+    Map<String, Object> clusterState = clusterObject(getCluster(""));
+    assertNull(clusterState.get("live_nodes"));
+    assertNull(clusterState.get("aliases"));
+    assertNull(clusterState.get("properties"));
+
+    Map<String, Object> collection = collection(clusterState, COLLECTION);
+    assertNotNull(collection.get("health"));
+    assertEquals("conf", collection.get("configName"));
+    assertNotNull(collection.get("router"));
+    assertEquals(Set.of("shard1"), shards(collection).keySet());
+    assertNotNull(replica(collection).get("node_name"));
+    assertNotNull(replica(collection).get("state"));
+    assertTrue(aliasesOf(collection).contains(ALIAS));
+  }
+
+  @Test
+  @SuppressWarnings("unchecked")
+  public void testGeneratedClientReadsTheTree() throws Exception {
+    GetClusterStatusResponse response =
+        new ClusterApi.GetClusterStatus().process(cluster.getSolrClient());
+    assertNull(response.error);
+    CollectionState collection = response.cluster.collections.get(COLLECTION);
+    assertNotNull(collection);
+    assertEquals("conf", collection.configName);
+    assertNotNull(collection.health);
+    assertTrue(collection.aliases.contains(ALIAS));
+    Map<String, Object> router = (Map<String, Object>) collection.unknownProperties().get("router");
+    assertEquals("compositeId", router.get("name"));
+
+    ReplicaState replica = collection.shards.get("shard1").replicas.values().iterator().next();
+    assertNotNull(replica.nodeName);
+    assertNotNull(replica.state);
+    assertEquals("true", replica.leader);
+  }
+
+  @Test
+  public void testV1SelectionParamsAreIgnored() throws Exception {
+    Map<String, Object> clusterState =
+        clusterObject(
+            getCluster("?liveNodes=true&aliases=true&clusterProperties=true&includeAll=true"));
+    assertNull(clusterState.get("live_nodes"));

Review Comment:
   oh right...  the bean validation stuff...    I actually really wish that stuff was simpler/nicer in Jersey...    More like how Rails handles that stuff...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139157392


##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetClusterStatus.java:
##########
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import static org.apache.solr.security.PermissionNameProvider.Name.COLL_READ_PERM;
+
+import jakarta.inject.Inject;
+import java.util.Map;
+import org.apache.solr.client.api.endpoint.GetClusterStatusApi;
+import org.apache.solr.client.api.model.GetClusterStatusResponse;
+import org.apache.solr.client.api.model.GetClusterStatusResponse.CollectionState;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.ShardParams;
+import org.apache.solr.common.util.CollectionUtil;
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.handler.admin.ClusterStatus;
+import org.apache.solr.jersey.PermissionName;
+import org.apache.solr.jersey.SolrJacksonMapper;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
+
+/**
+ * V2 API for the collections, shards, and replicas tree.
+ *
+ * <p>{@code GET /api/cluster} returns that tree and nothing else hanging off the cluster object.
+ * Live nodes, aliases, and cluster properties stay on their own endpoints. v1 {@code CLUSTERSTATUS}
+ * is unchanged.
+ */
+public class GetClusterStatus extends AdminAPIBase implements GetClusterStatusApi {
+
+  @Inject
+  public GetClusterStatus(
+      CoreContainer coreContainer, SolrQueryRequest req, SolrQueryResponse rsp) {
+    super(coreContainer, req, rsp);
+  }
+
+  @Override
+  @PermissionName(COLL_READ_PERM)
+  public GetClusterStatusResponse getClusterStatus(
+      String collection, String shard, String routeKey, Boolean prs) throws Exception {
+    final GetClusterStatusResponse response =
+        instantiateJerseyResponse(GetClusterStatusResponse.class);
+    validateZooKeeperAwareCoreContainer(coreContainer);
+    if (collection != null) {
+      recordCollectionForLogAndTracing(collection, solrQueryRequest);
+    }
+
+    // Only the parameters this API documents. includeAll, liveNodes, aliases, and

Review Comment:
   > yeah, not sure we should still be documenting the includeAll and liveNodes etc at this level. One comment, okay, but seems like too many
   
   shortened that to one line. those params are still ignored if someone sends them.. we only bind collection, shard, _route_, and prs.
   
   > what happens if you pass them in? does it get run?
   
   so they are ignored. the handler builds a fresh param set from the documented query params only, so liveNodes / aliases / clusterProperties / includeAll never reach ClusterStatus.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4139143156


##########
solr/api/src/java/org/apache/solr/client/api/model/GetClusterStatusResponse.java:
##########
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.api.model;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Response body for {@code GET /api/cluster}.
+ *
+ * <p>Shards, replicas, health, and the other stable collection-state fields are typed. A collection
+ * state document is otherwise open: router settings, replica placement counts, user properties, and
+ * per-replica state are preserved on the object rather than dropped. Live nodes, the alias map, and
+ * cluster properties are not part of this response. Each collection still lists the aliases that
+ * point at it.
+ */
+public class GetClusterStatusResponse extends SolrJerseyResponse {
+
+  @Schema(
+      description =
+          "Cluster geometry. Does not include live nodes, the alias map, or cluster properties.")

Review Comment:
   agreed, trimmed wording here. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4167847983


##########
solr/core/src/test/org/apache/solr/handler/admin/api/ListCollectionsDetailedStandaloneTest.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.handler.admin.api;
+
+import org.apache.solr.SolrTestCase;
+import org.apache.solr.client.solrj.RemoteSolrException;
+import org.apache.solr.client.solrj.request.CollectionsApi;
+import org.apache.solr.util.SolrJettyTestRule;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+
+/** Standalone coverage for {@code GET /api/collections?detailed=true}. */

Review Comment:
   yeah...detailed=true is the new cloud-only path, so locking the 400 on standalone seems worth keeping



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4164224084


##########
solr/webapp/web/js/angular/services.js:
##########
@@ -162,10 +162,9 @@ solrAdminServices.factory('Metrics',
     })
 .factory('Collections',
   ['$resource', function ($resource) {
-    // v2 ClusterAPI (/api/cluster) delegates straight through to the same v1 CollectionsHandler
-    // that v1's CLUSTERSTATUS action used, so the response shape is byte-identical -- no
-    // generated solrApi client class exists for it (old-style @EndPoint API, predates the
-    // OpenAPI-based v2 framework), so this stays a plain $resource, like Threads/ParamSet.
+    // GET /api/cluster returns {cluster: {collections: ...}}, the collections, shards, and
+    // replicas tree. Live nodes, the alias map, and cluster properties are not in this payload.
+    // This stays a plain $resource, like Threads/ParamSet.
     return $resource('/api/cluster', {'wt':'json', '_':Date.now()}, {

Review Comment:
   updated :)  admin UI now uses ClusterV2.getClusterStatus. also typed router + replicationFactor on CollectionState so the overview page still gets those
   <img width="1400" height="957" alt="collection-overview" src="https://github.com/user-attachments/assets/4338208e-86ff-4056-98ed-2708c677ec1b" />



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Make GET /api/cluster return only the collections tree [solr]

Posted by "iprithv (via GitHub)" <gi...@apache.org>.
iprithv commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4164224084


##########
solr/webapp/web/js/angular/services.js:
##########
@@ -162,10 +162,9 @@ solrAdminServices.factory('Metrics',
     })
 .factory('Collections',
   ['$resource', function ($resource) {
-    // v2 ClusterAPI (/api/cluster) delegates straight through to the same v1 CollectionsHandler
-    // that v1's CLUSTERSTATUS action used, so the response shape is byte-identical -- no
-    // generated solrApi client class exists for it (old-style @EndPoint API, predates the
-    // OpenAPI-based v2 framework), so this stays a plain $resource, like Threads/ParamSet.
+    // GET /api/cluster returns {cluster: {collections: ...}}, the collections, shards, and
+    // replicas tree. Live nodes, the alias map, and cluster properties are not in this payload.
+    // This stays a plain $resource, like Threads/ParamSet.
     return $resource('/api/cluster', {'wt':'json', '_':Date.now()}, {

Review Comment:
   updated :)  admin UI now uses ClusterV2.getClusterStatus. also typed router + replicationFactor on CollectionState so the overview page still gets those
   
   <img width="2546" height="1369" alt="Screenshot 2026-10-02 at 4 12 28 PM" src="https://github.com/user-attachments/assets/0bdfde32-8ccb-4358-b312-6314eb1c8aec" />



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18450: Relocate GET /api/cluster under /api/collections and return only the collections tree [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4952:
URL: https://github.com/apache/solr/pull/4952#discussion_r4214256586


##########
solr/solr-ref-guide/modules/upgrade-notes/pages/major-changes-in-solr-11.adoc:
##########


Review Comment:
   Upon doing a backport as indicated by the Milestone, I see this PR touches this ref guide page for 11, which rightfully doesn't exist in branch_10x.  If the intent is to make this change in 10x then it should be documented on the 10x page not the 11x one.  So there's an inconsistency here.  IMO either move the docs or this stays in 11x (change Milestone accordingly).  @epugh 
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org