Magento – Elastic search was not working in Magento 2.3.2 (Enterprise edition)

elasticsearchmagento2magento2.3magento2.3.1magento2.3.2

Here I have configured the elastic search 6.0 in Magento 2.3.2 (Enterprise Edition).
Backend configurations are done and it shows Successfully connected.

FYR, I have attached the screenshot for backend configuration,

enter image description here

After configuring Elastic search 6.0 configurations, I did the following steps,

  1. In Admin panel refresh the Page cache in Cache Management
  2. Clean the cache in server.
  3. After that run the following command in the server

    php bin/magento indexer:reindex

But in frontend normal search only working.

Is there any method to check the Elastic search is working or not?

How can we know it's working properly? Suggest me some ideas if anything is missed.

Thanks in Advance 🙂

Best Answer

Open below URL directly in the browser

http://127.0.0.1:9200/_cat/indices?v

127.0.0.1 - Replace with Elasticsearch Server Hostname

9200 - Replace with Elasticsearch Server Port

Will show below table:

health status index              uuid                       pri rep     docs.count docs.deleted store.size pri.store.size
yellow open   magento2_product_1_v1 36z4LMghSvSMLV2_9itYSg   5   1         50            0       89kb           89kb
yellow open   magento2_product_2_v1 dxUmodV_S0i_Y5Tcv10zIQ   5   1         52            0     86.3kb         86.3kb

In the above table, it will list out all the indexes and along with the docs.count, that will show how many documents(products) are already indexed. docs.deleted column will show if any document which may require indexing. It will be reset to 0 once reindexing performed from Magento.

To show which products have been indexed as documents in the elastic search.

http://127.0.0.1:9200/magento2_product_2_v1/_search?pretty=true

magento2_product_2_v1 = If require then replace index name

Will show something as below along with all product information.

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 52,
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "magento2_product_2_v1",
        "_type" : "document",
        "_id" : "14",
        "_score" : 1.0,
        "_source" : {
          "store_id" : "2",
          "sku" : "SKU-6KYPBY3CMK",
          "status" : "1",
          "status_value" : "Enabled",.....

"total" will show how many products exist in the index. Here it is 52.

Use below commands to verify explicitly whether elastic search returning results or not.

Will show results name having bag

curl -X GET "127.0.0.1:9200/magento2_product_2_v1/_search?q=name:bag&pretty"

Will show results name having * :)

curl -X GET "127.0.0.1:9200/magento2_product_2_v1/_search?q=name:*&pretty"

Will show all the products of a given index

curl -X GET "127.0.0.1:9200/magento2_product_2_v1/_search?q=*:*&pretty"

Search across all available indices using below

curl -X GET "127.0.0.1:9200/_all/_search?q=*:*&pretty"
Related Topic