chef-api
chef-api copied to clipboard
partialSearch Issue
i wana get only the ip address of node " server 1 "
im sending a request like this
Code :
chef.partialSearch("node", "name:server1",{"ip":"ipaddress"} ,function(err, res){
if (err){console.log(error);}
else{console.log(res);}
}); Or chef.partialSearch("node", { q: "name:server1"} ,{"ip":"ipaddress"} ,function(err, res){ .... });
=> Response :
received status code 400 invalid value 'ipaddress' for no_key
function in code source : partialSearch: function(index, qs, data, fn) { ... }
Can you please give a valid syntax with example . Thanks
Correct Syntax For Search Methods
Simple Search : Exemple
chef.search("node", {q: "name:server1" }, function(err, res){
if (err){console.log(error);}
else{console.log(res);}
});
Partial Search : Exemple
chef.partialSearch("node", {q: "role:web"}, { name: ['name'] , 'ipaddress': ['ipaddress'] }, function(err, res){
if (err){console.log(error);}
else{console.log(res);}
});