I am trying to insert/update documents in IBM's Discovery service via the watson-developer-cloud Node.js SDK, and it's not working. Some of my documents don't have an associated file, so they are metadata-only. This documentation says that You must provide document content, metadata, or both.
However, the updateDocument call fails if you try to update a metadata-only document.
I tracked down the problem to line 607 in node-sdk/discovery/v1.js which is requiredParams: ['environment_id', 'collection_id', 'document_id', 'file']
and I believe that is the source of the problem, as it indicates that 'file' is a required parameter, contrary to what the API documentation states. The API documentation must be correct, because I can update a metadata-only document just fine from the Discovery API explorer.
You just need to make sure you call
updateJsonDocument()
and send an empty objectThe documentation is not updated but you can see the method here.