Adding records after the initial load

You can add more records to the data store at any time after the initial loading of records is complete.

Adding more records after the data store is created and its Dgraph process is up and running with the initially-loaded record set is very similar to the initial-load scenario, which means:
  • You use the ingestRecords operation with the addAssignments element and one or more mdex:record elements.
  • If you are adding new records with new primary keys, you must use the primaryKey element in the request. Otherwise, do not use this element if the new records use an existing primary-key attribute.
  • As with an initial load operation, standard attributes are created as needed when non-existent attributes are specified for a new record. The PDR for the standard attribute will use the system default settings.
  • If a standard attribute is configured as multi-assign, a record can have multiple assignments of that attribute.
  • You can add multiple records with the same request. You can also update other, existing records with the same request.

In addition, the request can contain deleteRecords elements to delete records.

New record request

The format of the ingestRecords request to add new records is the same as documented in the "Adding new records" topic in this section.

Note: If you submit the ingestRecords request after a Transaction Web Service request that starts an outer transaction, the request must specify the outer transaction ID. If no outer transactions have been started, the ID attribute must be omitted in the request.
For example, this request adds two records to the data store:
<ingest:ingestRecords 
      xmlns:ingest="http://www.endeca.com/MDEX/ingest/1/0" 
      xmlns:mdex="http://www.endeca.com/MDEX/XQuery/2009/09">
   <ingest:addAssignments>
      <mdex:record>
         <partID>P247</partID>
         <color>blue</color>
         <weight>3</weight>
         <price>19.99</price>
      </mdex:record>
      <mdex:record>
         <supplierID>S394</supplierID>
         <company>Acme Inc.</company>
         <phone>1-555-123-4567</phone>
      </mdex:record>
   </ingest:addAssignments>
</ingest:ingestRecords>

Note that none of the key-value assignments specify a Dgraph property type. This is because all the attributes already exist in the data store and therefore do not need to be created. The type of the assignment property value must match the type of the attribute.