code: func isStatusCode(err interface{}, code int) bool {
  	switch e := err.(type) {
  	case *http.Response:
  		return e.StatusCode == code
  	case *elasticError:
  		return e.Status == code
  	case elasticError:
  		return e.Status == code
  	case int:
  		return e == code
  	}
  	return false
  }
docs: // isStatusCode returns true if the given error indicates that the Elasticsearch
  // operation returned the specified HTTP status code. The err parameter can be of
  // type *http.Response, *Error, Error, or int (indicating the HTTP status code).