After much searching the internet and seeing multiple posts about this subject I can only think that many others are greatly confused with the use of the Cloudant In node in Node-Red. I think my problem was terminology and not being familiar enough with the Cloudant nomenclature more than anything and the user interface in Node needs a little more work.
I basically want to return all documents where name=XXXXX. My document is pretty simple, here is an example:
So lets start by looking at my index definition:
Now you will notice I have three references to “namesearch”:
- The design document name is “_design/namesearch”
- The Index name is “nameSearch”
- The index in the search index function is also named “nameSearch”
My flow takes in an HTTP request, formats it with the Selector node, and passes the query on to the Cloudant In node:
The selector node is pretty basic, after following many different instructions I finally resolved the problems with this function:
This results in a payload that looks like this:
nameSearch:Create a category layout
The Cloudant In node now has the following configuration (which seemed to be the primary problem, I will explain later:
The problem I had was I could not future out the search index fields. Mainly because this is the form when no fields are filled in:
Notice it specifically says “design document“. Now, anyone that is not familiar with this, based on my configuration, would most likely fill it out like this:
But after scouring many documents on the internet a suggestion was to just remove the “_design/” from the first field. Which resulted in the correct version I have above:
Needless to say this actually took me hours to figure out because I thought it was something with the query being passed in!
If you are not familiar with Node-Red then click this link.