I have just started using the FOSElasticaBundle and have so far found it really good to use. I am not sure if it is my ignorance of the bundle/Elastica or my lack of knowledge about ElasticSearch in general, but is it possible to have a CustomScore query with pagination?
If I try calling setFrom/setSize on the CustomQuery object I am told that the methods do not exist. If I create a Query object and setFrom and size there and pass this query into the CustomScore query object then the pagination parameters are ignored. I have included a copy of my code for what it is worth...
$queryString = new QueryString();
$queryString->setFields(array('_all'))
->setDefaultOperator('OR')
->setQuery($terms);
$query = new \Elastica\Query();
$query->setQuery($queryString);
$query->setSize($maxItems);
$query->setFrom(($page - 1) * $maxItems);
$custScoreQuery = new CustomScore();
$custScoreQuery->setQuery($query);
$custScoreQuery->setScript("_score * (doc['section.id'] == 7) ? 0.5 : 1");
$index = $this->get('fos_elastica.index.search_en_gb');
$results = $index->search($custScoreQuery);
Any help gladly accepted :o)