ElasticsearchDSL icon indicating copy to clipboard operation
ElasticsearchDSL copied to clipboard

Unable to add multiple field sorts

Open jrodger opened this issue 8 years ago • 1 comments

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 avatar Aug 23 '17 14:08 jrodger

Pull request #236

jrodger avatar Aug 23 '17 14:08 jrodger