improve pagination for different versions of ES