fix an ArrayIndexOutOfBoundsException that could occur if ESSearchTask fails

(cherry picked from commit 54531d0dccee8906c33bd1b294b6e8f123e7263b)