为了业务的需要的,我们常常需要查询交易中的一些自定义的参数,比如transfer 中的memo
当我们按找REST API文档使用时,
http://39.106.103.152:8080/v0/search/transactions?start_block=0&block_count=327722&limit=10&sort=desc&q=receiver:eosio.token+action:transfer+data.memo:return
会报不支持
"server error: unable to initiate to search: The following fields you are trying to search are not currently indexed: 'data.memo'. Contact our support team for more."
解决方案
被索引的操作的数据字段定义为search-common-indexed-terms默认配置为"receiver, account, action, auth, scheduled, status, notif, input, event, ram.consumed, ram.released, db.key, db.table, data.account, data.active, data.active_key, data.actor, data.amount, data.auth, data.authority, data.bid, data.bidder, data.canceler, data.creator, data.executer, data.from, data.is_active, data.is_priv, data.isproxy, data.issuer, data.level, data.location, data.maximum_supply, data.name, data.newname, data.owner, data.parent, data.payer, data.permission, data.producer, data.producer_key, data.proposal_name, data.proposal_hash, data.proposer, data.proxy, data.public_key, data.producers, data.quant, data.quantity, data.ram_payer, data.receiver, data.requested, data.requirement, data.symbol, data.threshold, data.to, data.transfer, data.voter, data.voter_name, data.weight, data.abi, data.code"
所有不以data.“.”开头的字段都是“固定的”,这意味着您可以将它们包含在列表中以对其进行索引或关闭以禁用对其的索引编制,但是我们不能添加新的字段(block_timestamp例如,将被拒绝)。
所有开始data.都是动态的字段,并且可以是任何字段,如果它们与操作的字段名称匹配,则将对其进行索引,例如,如果您部署了具有操作event_id且data.event_id列表中有的智能合约,则可以按receiver:mycontract data.event_id:something。
现在,大约data.memo可以将其添加到列表中,它将起作用,但是它将是完全匹配的,在memo数据上没有标记化,也没有解释。一个手段memo形式first second third,data.memo:first将不匹配,只有data.memo:'first second third'将匹配字段。
最终修改
编译dfuse.yaml,在flags中添加
search-common-indexed-terms: "receiver, account, action, auth, scheduled, status, notif, input, event, ram.consumed, ram.released, db.key, db.table, data.account, data.active, data.active_key, data.actor, data.amount, data.auth, data.authority, data.bid, data.bidder, data.canceler, data.creator, data.executer, data.from, data.is_active, data.is_priv, data.isproxy, data.issuer, data.level, data.location, data.maximum_supply, data.name, data.newname, data.owner, data.parent, data.payer, data.permission, data.producer, data.producer_key, data.proposal_name, data.proposal_hash, data.proposer, data.proxy, data.public_key, data.producers, data.quant, data.quantity, data.ram_payer, data.receiver, data.requested, data.requirement, data.symbol, data.threshold, data.to, data.transfer, data.voter, data.voter_name, data.weight, data.abi, data.code, data.memo"
在原有数据基础上增加data.memo
,重新运行dfuseeos 即可
参考
https://github.com/dfuse-io/dfuse-eosio/issues/209
版权属于:区块链中文技术社区 / 转载原创者
本文链接:https://bcskill.com/index.php/archives/1009.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!