Check that es response is not a WP_Error before using as an array

Prevents fatal errors when the es query returns a `WP_Error`