code: func (cmd *ImportCommand) importBits(ctx context.Context, useColumnKeys, useRowKeys bool, bits []pilosa.Bit) error {
  	logger := log.New(cmd.Stderr, "", log.LstdFlags)
  
  	// If keys are used, all bits are sent to the primary translate store (i.e. coordinator).
  	if useColumnKeys || useRowKeys {
  		logger.Printf("importing keys: n=%d", len(bits))
  		if err := cmd.client.ImportK(ctx, cmd.Index, cmd.Field, bits, pilosa.OptImportOptionsClear(cmd.Clear)); err != nil {
  			return errors.Wrap(err, "importing keys")
  		}
  		return nil
  	}
  
  	// Group bits by shard.
  	logger.Printf("grouping %d bits", len(bits))
  	bitsByShard := http.Bits(bits).GroupByShard()
  
  	// Parse path into bits.
  	for shard, chunk := range bitsByShard {
  		if cmd.Sort {
  			sort.Sort(http.BitsByPos(chunk))
  		}
  
  		logger.Printf("importing shard: %d, n=%d", shard, len(chunk))
  		if err := cmd.client.Import(ctx, cmd.Index, cmd.Field, shard, chunk, pilosa.OptImportOptionsClear(cmd.Clear)); err != nil {
  			return errors.Wrap(err, "importing")
  		}
  	}
  
  	return nil
  }
docs: // importBits sends batches of bits to the server.