Skip to content

Commit 28fe117

Browse files
authored
Update Sort.php
1 parent eefb686 commit 28fe117

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Search/Sorting/Sort.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public function toDSL(): array
5151
}
5252

5353
if ($this->script !== null) {
54-
$this->field = '_script';
5554
$details['script'] = $this->script->toDSL();
5655
}
5756

@@ -61,7 +60,7 @@ public function toDSL(): array
6160

6261
$details['order'] = $this->order;
6362

64-
return [$this->field => $details];
63+
return [$this->script !== null ? '_script' : $this->field => $details];
6564
}
6665

6766
public function __toString(): string

0 commit comments

Comments
 (0)