ES: fixed issue with storing empty records

fixes #3587