Writing to ES db