protected function configure(): void
{ } protected function execute(InputInterface
$input, OutputInterface
$output): int
{ if (!
$this->client->
ping()) { throw new \
RuntimeException('Elasticsearch server is not accessible'
);
} $table =
new Table($output);
$table->
setHeaders(['Name', 'Status'
]);
$health =
$this->client->
cluster()->
health();
$table->
addRow(['Cluster Status',
$health['status'
]]);
$table->
addRow(['Available Nodes',
$health['number_of_nodes'
]]);
$indexTask =
$this->connection->
fetchAssociative('SELECT * FROM elasticsearch_index_task WHERE entity = "product" LIMIT 1'
);
$totalProducts =
(int) $this->connection->
fetchOne('SELECT COUNT(*) FROM product WHERE version_id = :liveVersionId AND child_count = 0 OR parent_id IS NOT NULL',
['liveVersionId' => Uuid::
fromHexToBytes(Defaults::LIVE_VERSION
)]);
// No entry in key
if ($indexTask === false
) {