We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    If your site has installed a third-party search engine and you want to know the elastic search is enabled or not, you can identify it.

    First, you need to instantiate the MagentoElasticsearchModelConfig class to your __construct() method.

    And then you can use the below code.

    <?php
    namespace MagemonkeysElasticsearchModel;
    
    use MagentoElasticsearchModelConfig;
    
    class ConfigData
    {
        /**
         * @var Config
         */
        private $config;
    
        public function __construct(
            Config $config
        ) {
            $this->config = $config;
        }
    
        /**
         * @return bool
         */
        public function isElasticsearchEnabled()
        {
            return $this->config->isElasticsearchEnabled();
        }
    }

    Now, you need to call below command.

    $result = $this->isElasticsearchEnabled();

    The result will be true if your site has enabled elastic search.

    field_5bfb909c5ccae

      Get a Free Quote