*--store_xids: Generate a xid edge for each node. It will store the XIDs (The identifier / Blank-nodes) in an attribute named xid in the entity itself. It is useful if you gonna use External IDs.*
Does xid attribute needs to be defined in my type for bulk loader to store xid when --store_xids flag was used?
Below is my typical type. Since we want to use bulk loader, should we define an explicit xid attribute as part of the type declaration?
Bulk loader is not made to be used consecutively back to back. Hence all data is treated as one source of blank nodes and no need for xid. From your other posts I see you are trying to script it to run multiple times with multiple files and probably expect the data to be interlinked, but are finding out it is not because of this xid issue.
And if you are going to use xid you need to put it on every GraphQL type and use @dgraph directive to map it to a single predicate, otherwise you will have a <type>.xid predicate for every type which will not work for bulk or live loading as those require ONE global predicate on every type.
Either remove it and it will not be available to the GraphQLAPI and you may need to adjust the DQL indexes for the predicate it creates for you, or change it to:
type Course {
codeId: CourseTcode!
eventId: Int!
timestamp: DateTime! @search
student: Student
xid: String! @search(by: [hash]) @dgraph(pred: "xid") # <-- copy on every type
}