In my experience (above ground piping anyway) it is always better to install pipe systems with "built in flexibility", that is either through expansion loops or otherwise change in directions, to avoid the use of expansion joints as they can be a maintenance nightmare.
Otherwise, please refer to this link for more information in selecting an expansion joint. Note that there are a lot of criteria that need to be met - particularly: materials, and axial and angular.