Fixes for rebuilding elastic migrations

This commit is contained in:
David Bomba 2025-11-23 07:32:37 +11:00
parent 6bfbd646ca
commit d4233e1667
2 changed files with 75 additions and 2 deletions

View File

@ -163,8 +163,7 @@ class RebuildElasticIndexes extends Command
*/
protected function getElasticsearchClient()
{
$hosts = config('elastic.client.hosts', ['localhost:9200']);
return ClientBuilder::create()->setHosts($hosts)->build();
return ClientBuilder::fromConfig(config('elastic.client.connections.default'));
}
/**

View File

@ -0,0 +1,74 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2025. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\DataMapper\Analytics;
use Turbo124\Beacon\ExampleMetric\GenericStructuredMetric;
class VerifactuLog extends GenericStructuredMetric
{
/**
* The type of Sample.
*
* Monotonically incrementing counter
*
* - counter
*
* @var string
*/
public $type = 'structured_metric';
/**
* The name of the counter.
* @var string
*/
public $name = 'verifactu.log';
/**
* The datetime of the counter measurement.
*
* date("Y-m-d H:i:s")
*
*/
public $datetime;
/**
* HTML content
*
* @var string
*/
public $html = '';
/**
* JSON data
*
* @var array
*/
public $json = [];
/**
* Initialize with either HTML or JSON content
*
* @param string|null $html HTML content
* @param array|null $json JSON data
*/
public function __construct(?string $html = null, ?array $json = null)
{
if ($html !== null) {
$this->html = $html;
}
if ($json !== null) {
$this->json = $json;
}
}
}