ongr-io / ElasticsearchDSL

Query DSL library for Elasticsearch
MIT License
460 stars 199 forks source link

Unable to add multiple field sorts #235

Open jrodger opened 7 years ago

jrodger commented 7 years ago

Adding multiple field sorts overwrites previous additions.

$search = new Search();

// Add some queries...

$sort1 = new FieldSort('acme1', null, ['order' => FieldSort::ASC]);
$sort2 = new FieldSort('acme2', null, ['order' => FieldSort::DESC]);
$search->addSort($sort1);
$search->addSort($sort2);

$body = $search->toArray() // Only $sort2 is present in the output

It's possible this is only occurring on Windows and seems to be related to the usage of uniqid as seen in some other issues.

jrodger commented 7 years ago

Pull request #236