i try to create a new document for the IBM Watson Discovery Service and I use the watson-developer-cloud/node-sdk
The content in the document should come from a string and not from a file. I tried like this but with no luck
discovery.addDocument({
environment_id: MYENVID,
collection_id: MYCOLID,
metadata:'{"Content-Type":"application/json"}',
file:Buffer.from("HERE IS MY TEXT", 'utf8')
}, function(err, data) {
if (err) {
return next(err);
} else {
return res.json(data)
}
});
this creates a document but with no content. This is how the result looks like
{
"id": "MYID",
"score": 1,
"metadata": {
"Content-Type": "application/json"
},
"enriched_field_units": 0
}
Is there something simple i miss?
You didn't miss anything. There is a bug in the SDK that's being worked on right now. It should be fixed soon. https://github.com/watson-developer-cloud/node-sdk/issues/369