code: public static Token<EsTokenIdentifier> obtainToken(RestClient client, User user) {
          EsToken esToken = obtainEsToken(client, user);
          return EsTokenIdentifier.createTokenFrom(esToken);
      }
docs: Obtain and return an authentication token for the current user.
  @param client The Elasticsearch client
  @return the authentication token instance in Hadoop Token format.