About updates

This topic will describe how you can incrementally update the records in an Endeca data domain.

Using the updateRecords sub-operation of ingestChanges, you can perform the following types of incremental updates:

Note that the addOrUpdateRecords sub-operation, which can also update an existing record with new assignments, is described in Adding records after the initial load.

How updates are applied

When adding standard attributes, the operation works as follows for the new standard attribute (i.e., the standard attribute to be added):
  • If the new standard attribute already exists in the data domain but with a different type, an error is thrown and the new standard attribute is not added.
  • If the new standard attribute already exists in the data domain and is of the same type, no error is thrown and nothing is done.
  • If the new standard attribute is a primary-key attribute and a managed attribute already exists with the same name, an error is thrown and the new standard attribute is not added.

Note that updating a record can cause it to change place in the default order. That is, if you have records ordered A, B, C, D, and you update record B, records A, C, and D remain ordered. However, record B may move as a result of the update, which means the resulting order might end up as B,A,C,D or A,C,B,D or another order.

If an attribute is single-assign, that is, a standard attribute whose PDR has the mdex-property_IsSingleAssign set to true, you cannot add a second value to it. In the color example, if color were a single-assign attribute and the record already had one color assignment, then an attempt to add a second color assignment would fail.

Order of update operations

An ingestChanges request can contain all types of updates (delete records, delete assignments, wildcard delete assignments, and add assignments). Before any such request is performed, some operations are broken down into their component operations:
  • Record updates are broken down into assignment additions, deletions, wildcard deletions, and replacements.
  • Record replacements are broken down into a record deletion and record addition.
  • Assignment replacements are broken down into a wildcard deletion and assignment addition.
Once these operations are broken down, all of the remaining operations are sorted into groups by type, and each group is processed in the following order:
  1. deleteRecords requests
  2. deleteAssignments requests
  3. wildcardDeleteAssignments requests
  4. addAssignments requests
  5. addRecords requests.

If a record attribute or attribute assignment is specified in the wildcardDeleteAssignments or deleteAssignments list and is specified again in the addAssignments list, then the attribute assignment is deleted and added again in the same transaction.

If identical records, standard attributes, or assignments are specified in any of the elements, the redundant entries are ignored.

If you are renaming a standard attribute, you can include only this operation inside updateRecords in ingestChanges. (Additional updateRecords are allowed in the same request, and can contain other updates, but not for the attribute that is being renamed.)

Affected records with update operations

The numRecordsAffected element in the ingestChangesResponse lists how many records were affected (i.e., modified) by an ingestChanges operation.

However, it is possible that an affected record may not actually be changed by the operation. Any operation that results in the output record being the same as the input record will mark the record as affected but will leave it unchanged. These types of unaffected operations are adding an assignment that already exists, deleting an assignment that does not exist, performing a wildcard delete on a record property that has no assignments, and deleting an assignment and then adding the same assignment.