1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-29 16:00:27 +02:00

Merge pull request #1523 from patrickkusebauch/feature/Elastica

Support for Elastica client up to v7.0.0, with optional drop support for ES types
This commit is contained in:
Jordi Boggiano
2020-12-14 13:16:06 +01:00
committed by GitHub
5 changed files with 75 additions and 9 deletions

View File

@@ -58,6 +58,9 @@ class ElasticaFormatter extends NormalizerFormatter
return $this->index;
}
/**
* @deprecated since Elastica 7 type has no effect
*/
public function getType(): string
{
return $this->type;
@@ -72,7 +75,9 @@ class ElasticaFormatter extends NormalizerFormatter
{
$document = new Document();
$document->setData($record);
$document->setType($this->type);
if(method_exists($document, 'setType')) {
$document->setType($this->type);
}
$document->setIndex($this->index);
return $document;

View File

@@ -25,7 +25,7 @@ use Elastica\Exception\ExceptionInterface;
* $client = new \Elastica\Client();
* $options = array(
* 'index' => 'elastic_index_name',
* 'type' => 'elastic_doc_type',
* 'type' => 'elastic_doc_type', Types have been removed in Elastica 7
* );
* $handler = new ElasticaHandler($client, $options);
* $log = new Logger('application');