Feature/issue 3533 and 3464

branch for issue [3533](https://github.com/elasticsearch/elasticsearch/issues/3533) and issue [3464](https://github.com/elasticsearch/elasticsearch/issues/3464), see commit messages