When does the couchbase server build an index with a "defer_build=true" clause?

I could not find this in the documentation. Neither could I figure this out by trying on a running cluster.

An index is created with defer_build=true. So the index is created but it is not built i.e. only the definition is present but structure/data is not created. My question is: when will the server build it? Will it be built only when somebody manually executes the “build” command? Not until then?

If so, what is the advantage of defer_build=true? Because then its as good as if the index never existed!

Thanks

you must use BUILD INDEX statement. https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/build-index.html

BUILD INDEX is capable of building multiple indexes at once, and can utilize a single scan of documents in the bucket to feed many index build operations.

I see. Thanks vsr1.

So defer_build is “do_not_build”. Its not “build at a later stage” OR “build in the background” OR “build asynchronously”.
It seemed as if it might get built on first access. But its neither of those. So its like creating and saving, just the definition. Seems a bit unintuitive but anyways…

Thanks

@pccb It means, the index will not be built right away but one or more indexes in the bucket can be built together when they are all created. You can find more information how this is helpful: https://blog.couchbase.com/deferring-of-index-creation/

Thank you Pratibha. That explains the advantage of defer_build + build. Appreciate.