在composer-rest-server中运行查询时出现CouchDB错误?

时间:2018-11-07 07:30:48

标签: hyperledger-composer

问题:

我已经建立了一个业务网络,并通过作曲家休息服务器进行了部署和连接。添加资产和执行交易功能按预期工作。但是,当我尝试在其中运行查询时,会出现这样的错误。

{
  "error": {
    "statusCode": 500,
    "name": "Error",
    "message": "transaction returned with failure: Error: GET_QUERY_RESULT failed: transaction ID: e21f7d122609b883f415d82786a197a192b90b344e1e30c304da6c21c838c8bb: Couch DB Error:no_usable_index,  Status Code:400,  Reason:No index exists for this sort, try indexing by the sort fields.",
    "stack": "Error: transaction returned with failure: Error: GET_QUERY_RESULT failed: transaction ID: e21f7d122609b883f415d82786a197a192b90b344e1e30c304da6c21c838c8bb: Couch DB Error:no_usable_index,  Status Code:400,  Reason:No index exists for this sort, try indexing by the sort fields.\n    at C:\\Users\\tharindusa\\AppData\\Roaming\\npm\\node_modules\\composer-rest-server\\node_modules\\fabric-client\\lib\\Peer.js:114:16\n    at C:\\Users\\tharindusa\\AppData\\Roaming\\npm\\node_modules\\composer-rest-server\\node_modules\\grpc\\src\\client.js:586:7"
  }
}

这是我的query.qry文件的样子。

query ListLandTitlesForSale{
    description: "List all land titles that are for sale"
   statement:
    SELECT org.landreg.LandTitle
    WHERE (forSale == true)
    ORDER BY [id ASC]
}

query ListLandTitlesBySize {
    description: "List all land titles in a certain size range"
  statement:
    SELECT org.landreg.LandTitle
    WHERE((area >_$minimumArea) AND (area< _$maximumArea))
    ORDER BY [area ASC]
}

query ListOwnedLandTitles {
    description: "List land titles owned by specified 'owner'"
    statement:
        SELECT org.landreg.LandTitle
      WHERE (owner == _$owner)
      ORDER BY [id ASC]
}

query ListPreviouslyOwnedLandTitles {
    description: "List land titles owned by specified 'previousOwner'"
    statement:
        SELECT org.landreg.LandTitle
      WHERE (previousOwners CONTAINS _$previousOwner)
      ORDER BY [id ASC]
}

这就是我的.cto文件的外观。

namespace org.landreg

abstract concept Address {
  o String addressLine
  o String locality
}

concept DutchAddress extends Address {
  o String postalCode regex=/\d{4}[ ]?[A-Z]{2}/
}

enum Gender {
  o FEMALE
  o MALE
}

participant Individual identified by passportNumber {
  o String passportNumber
  o DutchAddress address
  o Gender gender
}

asset LandTitle identified by id {
  o String id
  o DutchAddress address
  o Integer area range=[1000,]
  o Boolean forSale default=false
  o Double price optional
  --> Individual owner
  --> Individual[] previousOwners optional
}

transaction UnlockLandTitle {
  --> LandTitle landTitle
}

transaction TransferLandTitle {
  --> LandTitle landTitle
  --> Individual newOwner
}

docker ps命令的输出

TharinduSA@LP-HQ-15957 MINGW64 ~
$ docker ps -a
CONTAINER ID        IMAGE                                                                                                       COMMAND                  CREATED             STATUS                    PORTS                                            NAMES
373a6fbe104d        dev-peer0.org1.example.com-landreg-0.0.2-d2a95608b3ed19873963889cfc0dc8c12a2ff883775b0c1263b1f676cab351d5   "/bin/sh -c 'cd /usr…"   5 hours ago         Up 5 hours                                                                 dev-peer0.org1.example.com-landreg-0.0.2
00a0859aaee6        hyperledger/fabric-peer:1.2.0                                                                               "peer node start"        5 hours ago         Up 5 hours                0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp   peer0.org1.example.com
83247feca61f        hyperledger/fabric-orderer:1.2.0                                                                            "orderer"                5 hours ago         Up 5 hours                0.0.0.0:7050->7050/tcp                           orderer.example.com
a388dc58ac56        hyperledger/fabric-ca:1.2.0                                                                                 "sh -c 'fabric-ca-se…"   5 hours ago         Up 5 hours                0.0.0.0:7054->7054/tcp                           ca.org1.example.com
4ba58264053d        hyperledger/fabric-couchdb:0.4.10                                                                           "tini -- /docker-ent…"   5 hours ago         Up 5 hours                4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp       couchdb
5777ea4f350c        dev-peer0.org1.example.com-landreg-0.0.1-9515860cfe680a544a37838162e871043219ac02a5fd224ade345b1aa36d0051   "/bin/sh -c 'cd /usr…"   28 hours ago        Exited (0) 25 hours ago                                                    dev-peer0.org1.example.com-landreg-0.0.1
276df87ca139        dev-peer0.org1.example.com-landreg-0.0.3-2b5a4891dc9504a6280a81420f24ce56b450739cbdfd1d325214910967444f82   "/bin/sh -c 'cd /usr…"   30 hours ago        Exited (0) 29 hours ago                                                    dev-peer0.org1.example.com-landreg-0.0.3
52a0fd951af6        dev-peer0.org1.example.com-sample-0.0.1-3c933e68ad6460ca423125a9eb2529a68675271a61b9f8b3c6a8cd2e722e893c    "/bin/sh -c 'cd /usr…"   31 hours ago        Exited (0) 29 hours ago                                                    dev-peer0.org1.example.com-sample-0.0.1

有人可以帮我解决这个问题吗?我正在使用作曲者0.20.2版。

0 个答案:

没有答案