PIM-2221 Ensure entity ids are well stored inside the document