Smile-SA/elasticsuite

View on GitHub
src/module-elasticsuite-indices/Model/IndexMappingProvider.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php
/**
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer
 * versions in the future.
 *
 * @category  Smile
 * @package   Smile\ElasticsuiteIndices
 * @author    Dmytro ANDROSHCHUK <dmand@smile.fr>
 * @copyright 2020 Smile
 * @license   Open Software License ("OSL") v. 3.0
 */
namespace Smile\ElasticsuiteIndices\Model;

use Smile\ElasticsuiteCore\Api\Client\ClientInterface;

/**
 * Class IndexMappingProvider
 *
 * @category Smile
 * @package  Smile\ElasticsuiteIndices
 * @author   Dmytro ANDROSHCHUK <dmand@smile.fr>
 */
class IndexMappingProvider
{
    /**
     * @var ClientInterface
     */
    private $client;

    /**
     * Constructor.
     *
     * @param ClientInterface $client ES client.
     */
    public function __construct(
        ClientInterface $client
    ) {
        $this->client = $client;
    }

    /**
     * Get a mapping of index.
     *
     * @param string $indexName Index name.
     * @return array
     */
    public function getMapping($indexName): array
    {
        return $this->client->getMapping($indexName);
    }
}