Riddley Search in Ruby

Hello All,

I am new to chef and trying to figure out stuff as I go.
Here is my problem:

I am working on a ruby script to get a list of servers in a node group. When I use the following query, I can get the results

ridley.search(:node, “role:#{chef_role} AND chef_environment:#{env}”).each { |n|
But, when I search with the following,

ridley.search(:node, “role:#{chef_role} AND chef_environment:#{env} AND service_type:#{service_type}”).each { |n|

I get the following error

[2018-04-17T10:37:58.763287 #17333] ERROR – : Actor crashed! Ridley::Errors::HTTPBadRequest: {“error”:["invalid search query:

How can I add the extra “service_type” and get a successful search?

To quote directly from my response on StackOverflow:

Ridley is deprecated and no longer being maintained, don’t use it. – coderanger 32 mins ago

Use the chef-api gem instead, though that’s only marginally maintained. – coderanger 32 mins ago

Thanks @coderanger, was checking if there are any other options I could use.

Riddley worked for this query:

ridley.search(:node, “role:#{chef_role} AND chef_environment:#{env} AND service_type:#{service_type}”).each { |n|

and is throwing error when I try:

ridley.search(:node, “role:#{chef_role} AND chef_environment:#{env} AND service_type:#{service_type}”).each { |n|

So, focusing on why it is throwing an error.
ANy thoughts @coderanger ?

P.S : I started working on the chef-gem api