【发布时间】:2017-03-13 16:54:32
【问题描述】:
我尝试了很多方法来使用 PHP - Elastica 库 (FosElasticaBundle) 在 ElasticSearch 中执行简单的匹配值请求。但没有任何运行。你有正确运行这种代码的想法吗:
$match = new Match();
$match->setFieldQuery('product.price', 2);
$match->setFieldOperator('product.price', 'AND');
$query->setQuery($match);
我也在尝试这种形式:
$boolQuery = new \Elastica\Query\BoolQuery();
$fieldQuery = new \Elastica\Query\Match();
$fieldQuery->setFieldQuery('age', 'I am a title string');
$fieldQuery->setFieldParam('age', 'analyzer', 'my_analyzer');
$boolQuery->addShould($fieldQuery);
$query = $boolQuery;
return $this->find($query);
没有错误返回但没有结果。我就是想要这样的要求
SELECT * FROM product WHERE price = 2;
如何使用 FosElasticaBundle 做到这一点?
【问题讨论】:
标签: elasticsearch elastica foselasticabundle