for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace ApiPlatform\Core\Bridge\Elasticsearch\Metadata;
/**
* Document metadata.
* @see https://www.elastic.co/guide/en/elasticsearch/guide/current/_document_metadata.html
* @experimental
* @author Baptiste Meyer <[email protected]>
final class DocumentMetadata
{
const DEFAULT_TYPE = '_doc';
private $index;
private $type;
public function __construct(string $index = null, string $type = self::DEFAULT_TYPE)
$this->index = $index;
$this->type = $type;
}
* Gets a new instance with the given index.
public function withIndex(string $index): self
$metadata = clone $this;
$metadata->index = $index;
return $metadata;
* Gets the document index.
public function getIndex()
return $this->index;
* Gets a new instance with the given type.
public function withType(string $type): self
$metadata->type = $type;
* Gets the document type.
public function getType(): string
return $this->type;