Fixes bugs 921479, 943640 - Added new tests for the elasticsearch mapping

@peterbe or @ErikRose r?

Note: this new file is, at the moment, not strictly speaking testing the mapping. The reason is that I initially thought those bugs it solves where caused by problems in the mapping, but it was not the case. I decided to keep it around and use it as a base for other tests when we need to add some.