#!/usr/bin/env php
<?php

use app\service\Search\OpenSearchChunkIndex;

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../support/bootstrap.php';

try {
    $index = new OpenSearchChunkIndex();
    $index->ensureExists();

    echo 'OpenSearch chunk index initialized: ' . config('opensearch.indices.chunks', 'proofdb_chunks') . PHP_EOL;
    echo 'Vector dimensions: ' . config('opensearch.vector.dimensions', 2048) . PHP_EOL;
} catch (Throwable $exception) {
    fwrite(STDERR, $exception::class . ': ' . $exception->getMessage() . PHP_EOL);
    exit(1);
}
