|null $document Inline document to percolate.
*/
public function __construct(
private string $field,
private array|null $document = null,
private string|null $index = null,
private string|null $id = null,
)
{
if ($document === null && ($index === null || $id === null)) {
throw new \Spameri\ElasticQuery\Exception\InvalidArgumentException(
'Percolate query requires either a document, or both index and id.',
);
}
}
public function key(): string
{
return 'percolate_' . $this->field;
}
/**
* @return array