Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a TEXT index in CouchDB 2.0?

I'm reading this article https://cloudant.com/blog/mango-json-vs-text-indexes and I would like to create a TEXT index in my CouchDB

In the Fauxton -> Mango Indexes page, I posted

{
  "index": {
    "fields": [
      {
        "name": "id_str",
        "type": "number"
      }
    ]
  },
  "name": "doc_id",
  "type": "text"
}

...but got a 503 error with the following message:

{"error":"required index service unavailable","reason":"text"}

I wasn't able to find even any related info in their documentation and I feel really lost now.

So:

  1. How to create a TEXT index in CouchDB?
  2. Where can I find a decent introduction to indexes in CouchDB?

Please help, thanks.

like image 876
Frederick Zhang Avatar asked Apr 21 '17 04:04

Frederick Zhang


1 Answers

This error is different than an unknown index type since Couchdb 2.0 has stubs for text indexes, but doesn't directly implement them. These stubs depend on a dreyfus text index module provided by cloudant.

A guide to configuring and recompiling couchdb 2.0+ with Dreyfus (and its Clouseau dependency) can be found here. (I verified that these instructions work with the latest couchdb and dreyfus master branches as of 2017-04-22.)

like image 167
lossleader Avatar answered Oct 05 '22 07:10

lossleader