We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf7a735 commit 8fc648dCopy full SHA for 8fc648d
src/Aggregating/Metrics/TopHitsAggregation.php
@@ -12,7 +12,8 @@ class TopHitsAggregation implements Aggregation
12
public function __construct(
13
private string $name,
14
private ?int $size = null,
15
- protected ?SortCollection $sort = null,
+ private array $source = [],
16
+ private ?SortCollection $sort = null,
17
) {
18
Assert::stringNotEmpty(trim($name));
19
Assert::nullOrGreaterThan($this->size, 0);
@@ -39,6 +40,9 @@ public function toDSL(): array
39
40
if ($this->sort) {
41
$body['sort'] = $this->sort->toDSL();
42
}
43
+ if (!empty($this->source)) {
44
+ $body['_source'] = $this->source;
45
+ }
46
47
return [
48
$this->name => [
0 commit comments