code: func (c *InternalClient) CreateIndex(ctx context.Context, index string, opt pilosa.IndexOptions) error {
  	span, ctx := tracing.StartSpanFromContext(ctx, "InternalClient.CreateIndex")
  	defer span.Finish()
  
  	// Encode query request.
  	buf, err := json.Marshal(&postIndexRequest{
  		Options: opt,
  	})
  	if err != nil {
  		return errors.Wrap(err, "encoding request")
  	}
  
  	// Create URL & HTTP request.
  	u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s", index))
  	req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf))
  	if err != nil {
  		return errors.Wrap(err, "creating request")
  	}
  	req.Header.Set("Content-Length", strconv.Itoa(len(buf)))
  	req.Header.Set("Content-Type", "application/json")
  	req.Header.Set("Accept", "application/json")
  	req.Header.Set("User-Agent", "pilosa/"+pilosa.Version)
  
  	// Execute request against the host.
  	resp, err := c.executeRequest(req.WithContext(ctx))
  	if err != nil {
  		if resp != nil && resp.StatusCode == http.StatusConflict {
  			return pilosa.ErrIndexExists
  		}
  		return err
  	}
  	return errors.Wrap(resp.Body.Close(), "closing response body")
  }
docs: // CreateIndex creates a new index on the server.