I'm trying to deploy a chaincode with a couchdb index, but it's not working. I use Hyperledger fabric version 2.0 alpha and my chaincode is in go.
This is my index
{"index":{"fields":["price"]},"ddoc":"indexPriceDoc", "name":"indexPrice","type":"json"}
This is the folder structure: chaincode\META-INF\statedb\couchdb\indexes\indexPrice.json
This is the query in my chaincode
queryString := fmt.Sprintf("{\"selector\":{\"timeSlot\":\"%s\"},\"sort\":[{\"price\":\"asc\"}], \"use_index\":[ \"indexPriceDoc\",\"indexPrice\" ]}", subscribe.TimeSlot)
iterator, err := stub.GetQueryResult(queryString)
When execute the query in my log file I find this error:
2019-06-12 09:59:05.714 UTC [shim] handleGetQueryResult -> ERRO 005 [0f072238] Received ERROR
2019-06-12 09:59:05.714 UTC [offer] Error -> ERRO 006 Error querying offers: GET_QUERY_RESULT failed: transaction ID: 0f072238990b15b22696060305140880c6694028c1fac300511090f433dc2583: error handling CouchDB request. Error:no_usable_index, Status Code:400, Reason:No index exists for this sort, try indexing by the sort fields.
What is the mistake?