Cloud CMS maintains two indexes that are of interest for finding things. The primary index is the MongoDB index - against which you can run any query you can dream up using the MongoDB DSL. The secondary index is the Elastic Search index - against which you can run any search you can dream up using the Elastic Search DSL.
For information all kinds of really powerful stuff you can do with this, see:
- https://www.cloudcms.com/documentation/content-services/query.html
- https://www.cloudcms.com/documentation/content-services/search.html
- https://www.cloudcms.com/documentation/content-services/traversal.html
- https://www.cloudcms.com/documentation/content-services/find.html
However, there may be times where you want to run multiple lookups using the above-referenced approaches where one lookup depends on the results of the other lookup. You can solve this by writing code within your application that makes, say, two API calls.
Suppose for example that you have two content types - Book and Article - and an association type to relate them - Book Contains. Let's define these as "my:book", "my:article" and "my:contains".
Suppose then that you want to find all Books that contain articles that have the word "twitter" in them. You can do this by first searching for articles that contain the word "twitter". And then, second, you can search for books that have "my:contains" relationships to the articles you found.
Programmatically, it might look something like this if you're using the Cloud CMS JavaScript chaining library:
// start by collecting IDs for articles with the word "twitter" in them var articleIds = []; branch.searchNodes({ "filtered": { "query": { "query_string": { "query": "twitter" } }, "filter": { "type" : { "value" : "my:article" } } } }).each(function() { articleIds.push(this._doc); }).then(function() { // now find "my:contains" associations pointing to the books var bookIds = []; branch.queryNodes({ "_type": "my:contains", "target": { "$in": articleIds } }).each(function() { bookIds.push(this.source); }).then(function() { // all done! }); });
There are many other ways to do this. However, this should give you a basic idea of how to run back to back calls that make use of IDs retrieved from the first call to feed into the second.