code: function(definition, callback) {
        // if no definition is provided, then the user wants see all the indexes
        if (typeof definition === 'function' || typeof definition === 'undefined') {
          callback = definition;
          return nano.request({ path: encodeURIComponent(db) + '/_index' }, callback);
        } else {
          // the user wants to create a new index
          return nano.request({ path: encodeURIComponent(db) + '/_index',
            method: 'post',
            body: definition}, callback);
        }
      }
docs: https://console.bluemix.net/docs/services/Cloudant/api/cloudant_query.html#query