Backport elasticsearch-1.4.0 update from trunk