public function getDecorated(): AbstractElasticsearchSearchHydrator
{ throw new DecorationPatternException(self::
class);
} public function hydrate(EntityDefinition
$definition, Criteria
$criteria, Context
$context, array
$result): IdSearchResult
{ if (!
isset($result['hits'
])) { return new IdSearchResult(0,
[],
$criteria,
$context);
} $hits =
$this->
extractHits($result);
$data =
[];
foreach ($hits as $hit) { $id =
$hit['_id'
];
$data[$id] =
[ 'primaryKey' =>
$id,
'data' =>
array_merge( $hit['_source'
] ??
[],
['id' =>
$id, '_score' =>
$hit['_score'
]] ),
];