Cloudant query and view

The MDM and Cloudant® sample service implements part of its persistence layer through Cloudant query and view APIs. You must install the required scripts (either through the use of curl or from the Cloudant Dashboard) to implement or extend the retrieve and search API functions.

Query

Because Cloudant provides persistence, clients can always use the generic all docs query to retrieve all the documents in the database. However, to use the MDM and Cloudant sample service query APIs, administrators must define indexes on the service databases. Use the scripts that are provided in the cloudant_query_docs directory. For example:

curl -X POST 'https://<cloudant_userid>:<cloudant_password>@<cloudant_userid>.cloudant.com/namespaces/_index' --data @cloudant_query_docs/cq_person_firstname.json

See the related topics for information about the query APIs and all docs query (primary index search).

View

Cloudant Query does not allow indexes to be defined on array element values. For features such as "retrieve by last name", the MDM and Cloudant sample service implementation must use the older Cloudant View APIs. Administrators must define the views that are specified in the cloudant_view_docs subdirectory. While this can be done through cURL, it is easier to use the Cloudant Dashboard.



Last updated: November 6, 2015