updated to work with elasticsearch