Original commit: elastic/x-pack-elasticsearch@02425ca13d
Closes elastic/elasticsearch#477 Original commit: elastic/x-pack-elasticsearch@8926f6ca44