public function testRandomScore()
{
$filter = new Term(array('price' => 4.5));
$query = new FunctionScore();
$query->addRandomScoreFunction(2, $filter);
$expected = array('function_score' => array('functions' => array(array('random_score' => array('seed' => 2), 'filter' => array('term' => array('price' => 4.5))))));
$this->assertEquals($expected, $query->toArray());
$response = $this->type->search($query);
$results = $response->getResults();
// the document with the random score should have a score > 1, means it is the first result
$result0 = $results[1]->getData();
$this->assertEquals("Miller's Field", $result0['name']);
}