fixed elasticsearch write