3

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 :)

1
  • I believe that you have some customization that break it...
    – KAndy
    Aug 12, 2019 at 18:45

3 Answers 3

6

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"
2
  • Thanks for your detailed notes sandip. But it's not working for me. Aug 14, 2019 at 6:42
  • Sharing the logs of system exceptions, support_report can identify the issue.
    – sandip
    Aug 14, 2019 at 17:53
2

Following this page Have you tried running -

Verify that Elasticsearch is working by entering the following command on the server on which it is running:

curl -XGET '<host>:9200/_cat/health?v&pretty'

A message similar to the following is displayed:

 epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks
 1519701563 03:19:23  elasticsearch green           1         1      0   0    0    0        0             0
4
  • Thanks for your reply BigDaddyL, Here I have attached my result here epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent 1565614439 12:53:59 docker-cluster yellow 1 1 5 5 0 0 5 0 - 50.0% Aug 12, 2019 at 12:57
  • How can i justify the elastic search is working or not. Aug 12, 2019 at 12:59
  • For me, the status shows "Yellow", is that means working or not?
    – Jack
    Aug 29, 2019 at 6:17
  • @Jack yellow means that the primary shard is allocated but replicas are not ... found at Cluster Health API
    – robsch
    Aug 17, 2020 at 13:10
2

You can try monitoring the elasticsearch slowlog to see how the queries are actually being executed. Change the index from twitter to whatever your index name is or * for all. Then you can find the logs at:

var/log/elasticsearch/elasticsearch_index_search_slowlog.log

PUT /twitter/_settings {
     "index.search.slowlog.threshold.query.debug": "0s",
     "index.search.slowlog.threshold.fetch.debug": "0s",
     "index.search.slowlog.level": "debug" 
}

Here is a link to the elastic search (6.8) documentation on how to do this.

Elastic Search 6.8 Slowlog

Your Answer

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

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