Optimize the index prior to testing the mapping.

Related to pull request https://github.com/ruflin/Elastica/pull/359
Merge pull request #419 from jappievw/mapping-change-test-fixes

Optimize the index prior to testing the mapping.