2
votes

In Cloudant you can have a design document with views and query indexes.

When creating map/reduce views you just update the entire design document. The Cloudant docs explicitly state that:

So, to store a view, we simply store the function definition within a design document. A design document can be created or updated just like any other document.

However, there is a dedicated API for creating an index.

Is there any reason to use the dedicated API for creating indexes? Otherwise I'd rather directly create design documents with both views and indexes.

1

1 Answers

1
votes

Historically, the map-reduce views were the only indexing possible. Later, Cloudant developed the indexing API. The indexing API does overlap with the map-reduce features, but it also supports more features, such as indexing text.

I believe that map-reduce indexes, which execute your JavaScript code over and over (about once per database update) will build a bit slower than the newer indexes. (However, in my opinion, index build speed should not be a big concern. Once it's built, it's done, so why worry?)

Notice, that when you use the _index API to create an index, Cloudant creates a design document for you. If you had made that same document yourself, then Cloudant would not notice the difference. So if you prefer to update design documents yourself, then that is no problem.