code: public static Map<String, String> createEnvironment(Map<String, String> environment)
      {
          Map<String, String> result = null;
          
          try
          {
              result = EnvironmentUtils.getProcEnvironment();
          }
          catch (IOException ex)
          {
              throw new ElasticsearchSetupException(
                      "Cannot get the current process environment", ex);
          }
          
          // Clean up the base environment:
  
          // The elasticsearch start and plugin scripts print warnings if these environment variables
          // are set, so lets unset them.
          result.remove("JAVA_TOOL_OPTIONS");
          result.remove("JAVA_OPTS");
  
          // The following environment variables may interfere with the elasticsearch instance.
          result.remove("ES_HOME");
          result.remove("ES_JAVA_OPTS");
          result.remove("ES_PATH_CONF");
          result.remove("ES_TMPDIR");
  
          // Now that we have a clean environment, set the provided variables on it.
          if (environment != null)
          {
              result.putAll(environment);
          }
  
          return result;
      }
docs: Create an environment by merging the current environment and the supplied one.
  If the supplied environment is null, null is returned.
  @param environment
  @return an execution environment