Added compatibility with elasticsearch 1.x