I have tried a successful approach in Watson Retrieve and Rank, to set the 'ranker_id' from within the code snippet versus setting it as an environment variable.
Below is the code snippet:
var qs = require('querystring');
// search documents
var ranker_id = 'replace with ID';
var question = payload.input.text; //Only the question is required
var query = **qs.stringify({q: question, ranker_id: ranker_id, fl: 'id,title,contentHtml'});**
solrClient.get('fcselect', query, function(err, searchResponse) {...}.
In some versions of npm, qs also works- var qs = require('qs');
**This would be the requirement to deploy in all production architecture, where the code would reside in production servers & make calls to the API. In such a scenario, env variable(ranker_id) could not be set in production environment, hence this approach
You can see in this documentation here and see the all examples how to use Retrieve and Rank - IBM Watson.
In this case the password and username is Service Credentials.
One example search and rank:
See one example how Get information about a ranker:
Example Index documents: