Skip to content

Apache Lucene open-source search software

SOLR-9735: Fix v2 API for AutoscalingHistoryHandler.

Andrzej Bialecki99f576014233
diff --git a/solr/core/src/java/org/apache/solr/handler/admin/AutoscalingHistoryHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/AutoscalingHistoryHandler.java
index 1c568d6d93a..a70afcf5ae2 100644
--- a/solr/core/src/java/org/apache/solr/handler/admin/AutoscalingHistoryHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/admin/AutoscalingHistoryHandler.java
@@ -17,10 +17,13 @@
package org.apache.solr.handler.admin;
import java.lang.invoke.MethodHandles;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import org.apache.solr.api.Api;
+import org.apache.solr.api.ApiBag;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.cloud.autoscaling.SystemLogListener;
@@ -146,4 +149,14 @@ public class AutoscalingHistoryHandler extends RequestHandlerBase implements Per
return Category.ADMIN;
}
+ @Override
+ public Boolean registerV2() {
+ return Boolean.TRUE;
+ }
+
+ @Override
+ public Collection<Api> getApis() {
+ return ApiBag.wrapRequestHandlers(this, "autoscaling.history");
+ }
+
}
diff --git a/solr/solrj/src/resources/apispec/autoscaling.history.json b/solr/solrj/src/resources/apispec/autoscaling.history.json
new file mode 100644
index 00000000000..dadd6cb9a36
--- /dev/null
+++ b/solr/solrj/src/resources/apispec/autoscaling.history.json
@@ -0,0 +1,61 @@
+{
+ "documentation": "https://lucene.apache.org/solr/guide/solrcloud-autoscaling-api.html",
+ "description": "Autoscaling history handler allows retrieving past autoscaling events recorded in the .system collection.",
+ "methods": [
+ "GET"
+ ],
+ "url": {
+ "paths": [
+ "/cluster/autoscaling/history"
+ ],
+ "params": {
+ "collection": {
+ "type": "string",
+ "description": "Collection where autoscaling events are stored, '.system' by default.",
+ "default": ".system"
+ },
+ "q": {
+ "type": "string",
+ "description": "Arbitrary query to limit the selected events.",
+ "default": "*:*"
+ },
+ "sort": {
+ "type": "string",
+ "description": "Sorting criteria for returned events.",
+ "default": "id asc"
+ },
+ "action": {
+ "type": "string",
+ "description": "Trigger action name to select"
+ },
+ "message": {
+ "type": "string",
+ "description": "Event message to select"
+ },
+ "trigger": {
+ "type": "string",
+ "description": "Trigger name to select"
+ },
+ "type": {
+ "type": "string",
+ "description": "Event type to select"
+ },
+ "node": {
+ "type": "string",
+ "description": "Node name to select"
+ },
+ "stage": {
+ "type": "string",
+ "description": "Processing stage to select"
+ },
+ "beforeAction": {
+ "type": "string",
+ "description": "Action name to select events before the action was executed"
+ },
+ "afterAction": {
+ "type": "string",
+ "description": "Action name to select events after the action was executed"
+ }
+ }
+ }
+}