In the game engine there is an option to constrain rigid body translations and rotations on an axis:
Is it possible to do this with the 3D view rigid body physics system?
In blender 2.80 (and likely earlier versions), you can selectively lock translation and rotation axes, limiting physics simulations to your choosing.
Do this in the Transform sidebar (hit N to toggle).
As seen above, both X and Y axis has been locked, forcing simulation to only translate along Z-axis, but otherwise rotate freely.
This can be handy for quickly placing objects using physics. For example:
This is currently supported only in the Game Engine.
As a possible workaround, you could bake the simulation to keyframes and then remove the transform channels which you don't want.