需要使用FOSElasticaBundle将下一个json查询添加到php代码中:
"runtime_mappings": {
"Agreement": {
"type": "keyword",
"script": {
"source": "if(doc['winningBidder.edrpou'].size()>0 && doc['seller'].size()>0)\r\n{\r\nemit(\r\n doc['seller'].value+\":\"+\r\n doc['trading.id'].value+\":\"+\r\n doc['winningBidder.edrpou'].value+\":\"\r\n )\r\n}"
}
}
}
如果我在simple method(\Elastica\Query)-〉addParam()中设置这个:
->addParam('runtime_mappings', [
'Agreement' => [
'type' => 'keyword',
'script' => [
'source' => "if(doc['winningBidder.edrpou'].size()>0 && doc['seller'].size()>0)\r\n{\r\nemit(\r\n doc['seller'].value+\":\"+\r\n doc['trading.id'].value+\":\"+\r\n doc['winningBidder.edrpou'].value+\":\"\r\n )\r\n}"
]
]
])
然后,当我尝试收集查询时,我得到一个错误:
Unknown key for a START_ARRAY in [runtime_mappings].
2条答案
按热度按时间acruukt91#
或者,您可以从“runtime_mappings”数组开始创建查询,然后在以下位置添加所有其他参数:
vc9ivgsu2#
请尝试使用
setParam
而不是addParam