Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can update documents already in the index by submitting them with the

Javadoc github
modulesdk-model
labeldocument modes
com.attivio.sdk.ingest.DocumentMode

 described in the following sections. Use the

Javadoc github
methodsetMode-com.attivio.sdk.ingest.DocumentMode-
modulesdk-model
labelIngestDocument.setMode()
com.attivio.sdk.ingest.IngestDocument

 method.


Note that this API does not allow mixing "appends", "removes" and standard partial updates in the same document update.

...

Bulk Updates to Real-Time Fields

Use the

Javadoc github
modulesdk-model
labelBulkUpdate
com.attivio.sdk.ingest.BulkUpdate

 message to apply the same field value updates to all selected documents. You can use this message to update real-time fields. This message contains a template document to which you can add fields. The message also contains a list of document IDs and/or a query for selecting the documents to which you apply the update.

...

Code Block
BulkUpdate update = new BulkUpdate(DocumentMode.PARTIAL);

// Add some documents to apply this update to
update.addDocumentId("doc1");
update.addDocumentId("doc2");

// Set a query to select additional documents to apply this update to
update.setQuery("table:foo", QueryLanguages.SIMPLE);
// set query workflow so query will be parsed/tokenized prior to sending to engine
update.setQueryWorkflowQueue("defaultQuery");

// Set the fields to update (these must be real-time fields)
update.getDocument().setField("flagged", "1");
update.getDocument().setField("online", "0");

// Send the update and refresh
myDocumentClient.send(update);
myDocumentClient.refresh();


Noteinfo

The

Javadoc github
modulesdk-model
labelBulkUpdate
com.attivio.sdk.ingest.BulkUpdate

 message supports the following document modes: DocumentMode.PARTIAL and DocumentMode.DELETE.

Bulk Updates by ID and Partition Routing

Excerpt

If your index has partition routing configured to operate on a field other than the document ID, you must specify a value for the routing field when performing bulk updates by document ID. Failure to include a value for the routing field will cause Attivio to route documents to index partitions based on document-ID hash values (the default non-routing behavior).

As an alternative, you can perform a bulk update by query, since the selection-by-query mechanism will ensure that updates are routed to the correct index partitions for the existing documents. You can mimic a bulk update by ID by specifying a query of this form, replacing the various <ID_*> placeholders with your document IDs:

Code Block
languagetext
themeDJango
.id:OR(<ID_1>, <ID_2>, <ID_3>, … ,<ID_N>)



BulkUpdate and Workflows

The BulkUpdate message, in general, need not go through the full ingest workflow. Creating a small custom workflow for sending in bulk updates may be desriable. This workflow at a minimum requires a tokenizer and indexer stage.