IBM Cloudant Tutorials

Using a Secondary Index

Ideal for routine queries, secondary indexes use MapReduce to build indexes over large amounts of data.
If you learn better by seeing a demonstration, watch these videos first:

Provision the IBM Cloudant Service in Bluemix

If you do not already have the IBM Cloudant service provisioned in Bluemix, follow these steps to provision the service. ▼More

Replicate the sample database

You'll be working with a sample database in this tutorial. Follow these steps to replicate the sample datatabase. ▼More

Write a secondary index

Before we dive into using the API, let's first take a look at how to define a secondary index using MapReduce. ▼More

Review Map functions

As you probably saw in the primary index tutorial, our small sample database is filled with animals. Our first map function will render the diets of the animals in the database. ▼More

Review Reduce functions

Reduces are where things get really interesting. ▼More

Review the API Options

Secondary indexes have the same API options as the primary index, so you can limit, skip, slice, include_docs, and query for a specific key. ▼More

Find more videos and tutorials in the Learning Center.