Skip to content

Unexpected panic in ES bulk After

I use alias to handle index version changes, and somehow I assigned 2 indices to 1 alias, but I forgot to define the write index, I got the following panic when I update indices

panic: runtime error: invalid memory address or nil pointer dereference

When I dig deeper I found that current logic in ES bulk After can cause panic if the passed in bulk response is nil.

One of the cases is elastic: Error 400 (Bad Request): no write index is defined for alias..., which I meet :-).

We should check nil before getting something from bulk response, and check errors first is always a good idea.

Edited by Xing Xin