code: @Given("^I obtain elasticsearch cluster name in '([^:]+?)(:.+?)?' and save it in variable '(.+?)'?$")
      public void saveElasticCluster(String host, String port, String envVar) throws Exception {
  
          commonspec.setRestProtocol("http://");
          commonspec.setRestHost(host);
          commonspec.setRestPort(port);
  
          Future<Response> response;
  
          response = commonspec.generateRequest("GET", false, null, null, "/", "", "json", "");
          commonspec.setResponse("GET", response.get());
  
          String json;
          String parsedElement;
          json = commonspec.getResponse().getResponse();
          parsedElement = "$..cluster_name";
  
          String json2 = "[" + json + "]";
          String value = commonspec.getJSONPathString(json2, parsedElement, "0");
  
          if (value == null) {
              throw new Exception("No cluster name is found");
          } else {
              ThreadProperty.set(envVar, value);
          }
      }
docs: Save clustername of elasticsearch in an environment varible for future use.
  
  @param host   elasticsearch connection
  @param port   elasticsearch port
  @param envVar thread variable where to store the value
  @throws IllegalAccessException    exception
  @throws IllegalArgumentException  exception
  @throws SecurityException         exception
  @throws NoSuchFieldException      exception
  @throws ClassNotFoundException    exception
  @throws InstantiationException    exception
  @throws InvocationTargetException exception
  @throws NoSuchMethodException     exception