検索結果を並べ替えようとしていますが、次のコードを使用すると、並べ替えられていない結果が得られます (この例では、すべての結果に対してクエリを実行しています)。
$query = new \Elastica\Query();
$query->setSort(array('id' => array('order' => 'desc')));
$resultSet = $type->search($query); // where $type is an elastica type object
$results = $resultSet->getResults();
参考までに、私は FOSElasticaBundle を Symfony2 プロジェクト (を使用$type = $this->container->get('fos_elastica.index.website.myType');
) で使用していますが、違いはありません。
を使用してブラウザで直接クエリを作成するとhttp://localhost:9200/website/myType/_search?sort=id:desc&pretty=true
、結果が正しくソートされます。