0

Unfortunately I cant untick the default search engine in magento2 backend (vers. 2.4.6-p2)

enter image description here

I think the prio of these checkboxes are app/etc/env.php > core_config_data

I have configured my opensearch connection details in app/etc/env.php:

            'catalog' => [
                'search' => [
                    'engine' => 'elasticsearch7',
                    'enable_eav_indexer' => '0',
                    'elasticsearch7_server_hostname' => 'IP_ADRESS',
                    'elasticsearch7_server_port' => '9200',
                    'elasticsearch7_index_prefix' => 'magento2',
                    'elasticsearch7_enable_auth' => '0',
                    'elasticsearch7_server_timeout' => '15'
                ]
            ],

As soon as I get rid of this configuration, my shop doesnt work anymore.

snippet of my `system.log``

ail -f var/log/system.log 
[2023-08-29T11:00:25.561732+00:00] main.ERROR: elasticsearch7 search engine doesn't exist. Falling back to opensearch [] []

TL;DR how can I edit the Search Engine value?

I have also stumbled about this Github Issue, but it didnt help me

https://github.com/magento/magento2/issues/37236

Also I think my Opensearch connection works:

curl -X GET http://IP_ADRESS:9200/
{
  "name" : "cencosered",
  "cluster_name" : "opensearch",
  "cluster_uuid" : "NLf44PfuRZ2hLznVT2EfSg",
  "version" : {
    "distribution" : "opensearch",
    "number" : "2.9.0",
    "build_type" : "deb",
    "build_hash" : "1164221ee2b8ba3560f0ff492309867beea28433",
    "build_date" : "2023-07-18T21:22:32.045158091Z",
    "build_snapshot" : false,
    "lucene_version" : "9.7.0",
    "minimum_wire_compatibility_version" : "7.10.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "The OpenSearch Project: https://opensearch.org/"
}

1 Answer 1

0

The system configs field become non-readable when we have specified those configs as ENV variables, it can be in any of your root files ex. - env.php file, bootstrap.php or index.php.

If you want to remove the elasticsearch details from your env.php, you can do so and then set the search engines config through cli and then flush cache.

You can set your search engine configurations through following commands. -

bin/magento config:set catalog/search/engine elasticsearch7
bin/magento config:set catalog/search/elasticsearch7_server_hostname IP_ADRESS
bin/magento config:set catalog/search/elasticsearch7_server_port 9200
bin/magento config:set catalog/search/elasticsearch7_index_prefix magento2
bin/magento config:set catalog/search/elasticsearch7_server_timeout 15

you might not need these, as they are set by default. but still you can set them through cli as well.

bin/magento config:set catalog/search/elasticsearch7_enable_auth 0
bin/magento config:set catalog/search/enable_eav_indexer 1

same you can do so for your opensearch configs. you just have to change the path and serach-engine -

bin/magento config:set catalog/search/engine opensearch
bin/magento config:set catalog/search/opensearch_server_hostname HOSTNAME
bin/magento config:set catalog/search/opensearch_server_port PORT
bin/magento config:set catalog/search/opensearch_index_prefix PREFIX
bin/magento config:set catalog/search/opensearch_enable_auth 1
bin/magento config:set catalog/search/opensearch_username USERNAME
bin/magento config:set catalog/search/opensearch_password PASSWORD
bin/magento config:set catalog/search/opensearch_server_timeout 15

check file to see the remaining config paths

vendor/magento/module-open-search/etc/adminhtml/system.xml

2
  • thanks for your reply. Sadly my search engine is. still not recognized, like you can see in my screenshot
    – kekw
    Aug 29, 2023 at 12:23
  • can you confirm which search-engine you have installed. Also can you confirm if the Magento_Elasticsearch7 module is installed and is enabled. Aug 30, 2023 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.