Skip to content
Snippets Groups Projects
DeleteIndex.php 404 B
Newer Older
Pavel's avatar
Pavel committed
<?php

namespace IQDEV\ElasticSearch\Indexer;

final class DeleteIndex implements Index
{
    public function __construct(
        private string  $name,
        private ?string $id = null
    ) {
Pavel's avatar
Pavel committed
    }

    public function es(): array
    {
        $es = [
            'index' => $this->name
        ];

        if ($this->id) {
            $es['id'] = $this->id;
        }

        return $es;
    }
}