Original commit: elastic/x-pack-elasticsearch@02425ca13d
closes elastic/elasticsearch#630 Original commit: elastic/x-pack-elasticsearch@6deeb07412