Showing results for 
Search instead for 
Did you mean: 

How to index couch db in hyperledger fabric

0 Kudos

I'm trying to query my chaincode using this function


where the query is this

{\"selector\":{\"id\":\"%s\"},\"sort\": [{\"postingDate\": \"desc\"}]}

But on running ths query i get this error

  "error": {
    "message": "GET_QUERY_RESULT failed: transaction ID: f00857ff9ec4a195075e27d201f3461411c714780064d7c04483014efb224c2c: error handling CouchDB request. Error:no_usable_index,  Status Code:400,  Reason:No index exists for this sort, try indexing by the sort fields.",
    "code": "CustomError",
    "status": 500

So, acc to hyperledger fabric document i created an index file to index the db using the posting date

    "index": {
        "fields": [{
            "postingDate": "DESC"
    "ddoc": "indexPostingDate",
    "name": "indexPostingDate",
    "type": "json"

In the documentation it was mentioned that , this file has to be placed int \META_INF\statedb\couchdb\indexes.So i tried placing this following folder under the vendor folder and under the src folder directly.But, still i'm getting this error/

How to resolve this?

Accepted Solutions (0)

Answers (0)