package com.elastic.support.diagnostics.commands;

import com.elastic.support.diagnostics.chain.DiagnosticContext;

import java.util.Map;
import java.util.Set;

public class RunClusterQueriesCmd extends AbstractQueryCmd {

   public boolean execute(DiagnosticContext context) {

      String majorVersion = context.getVersion().substring(0, 1);
      Map<String, String> statements = (Map<String, String>) context.getConfig().get("restQueries-" + majorVersion);
      Set<Map.Entry<String, String>> entries = statements.entrySet();

      logger.debug("Generating full diagnostic.");

      for (Map.Entry<String, String> entry : entries) {
         runQuery(entry, context);
      }

      return true;
   }


}

@@ -326,22 +326,22 @@
 ().s
-ubstring(0, 1)
+plit(%22%5C%5C.%22)%5B0%5D
 ;%0A  
@@ -455,16 +455,183 @@
 rsion);%0A
+      if (statements == null) %7B%0A         throw new IllegalArgumentException(%22major version %5B%22 + majorVersion + %22%5D is not supported by this diagnostics tool%22);%0A      %7D%0A
       Se

Throw helpful error message on unsupported major