0

Elastic Search 6.5 on Magento 2.3.4 giving no results Hi, I have configured elasticsearch 6.5 and tried elasticsearch PHP client versions 6.7.1, 6.5.1, and 6.1.0. I am able to configure successfully. But search results return nothing.

Simple Curl queries on elasticsearch give results.

Please see below.

magento@magento:~$ curl -u elastic_magento -X GET "https://3.23.16.244/magento2_product_1_v10/_search?q=name:tomato&pretty"
Enter host password for user 'elastic_magento':
{
"took" : 14,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 0.87138504,
"hits" : [
{
"_index" : "magento2_product_1_v10",
"_type" : "document",
"_id" : "52",
"_score" : 0.87138504,
"_source" : {
"store_id" : "1",
"sku" : "SLB-01-1008",
"status" : "1",
"status_value" : "Enabled",
"visibility" : "4",
"tax_class_id" : "2",
"tax_class_id_value" : "Taxable Goods",
"messure" : "5434",
"weightattribute" : "5437",
"weight_for_db_small" : "5456",
"name" : "Tomato",
"url_key" : "tomato",
"shipping_product_location" : [
"5",
"6"
],
"category_ids" : [
2,
7
],
"position_category_2" : "10000",
"name_category_2" : "Dailybox+",
"position_category_7" : "0",
"name_category_7" : "Vegetables",
"price_0_1" : "23.000000",
"price_1_1" : "23.000000",
"price_2_1" : "23.000000",
"price_3_1" : "23.000000"
}
}
]
}
}

I constructed the Magento query which I captured using pcap is not giving any hits, total hits 0

curl -X GET http://localhost:9200/magento2_product_1/document/_search -H 'Content-Type: application/json' -d '{"from":0,"size":"10000","stored_fields":["_id","_score"],"sort":[{"_score":{"order":"desc"}}],"query":{"bool":{"must":[{"match":{"_search":{"query":"tomato","boost":2}}},{"match":{"sku":{"query":"tomato","boost":2}}},{"match":{"color_value":{"query":"tomato","boost":2}}},{"match":{"description":{"query":"tomato","boost":2}}},{"match":{"manufacturer_value":{"query":"tomato","boost":2}}},{"match":{"name":{"query":"tomato","boost":6}}},{"match":{"shipping_product_location_value":{"query":"tomato","boost":2}}},{"match":{"short_description":{"query":"tomato","boost":2}}},{"match":{"sku":{"query":"tomato","boost":7}}},{"match":{"status_value":{"query":"tomato","boost":2}}},{"match":{"tax_class_id_value":{"query":"tomato","boost":2}}},{"match":{"url_key":{"query":"tomato","boost":2}}},{"terms":{"visibility":["3","4"]}}]}},"aggregations":{"price_bucket":{"extended_stats":{"field":"price_0_1"}},"category_bucket":{"terms":{"field":"category_ids","size":500}},"entity_bucket":{"terms":{"field":"entity_id","size":500}},"messure_bucket":{"terms":{"field":"messure","size":500}},"weightattribute_bucket":{"terms":{"field":"weightattribute","size":500}}}}'

Results

{"took":8,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]},"aggregations":{"weightattribute_bucket":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"entity_bucket":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"price_bucket":{"count":0,"min":null,"max":null,"avg":null,"sum":null,"sum_of_squares":null,"variance":null,"std_deviation":null,"std_deviation_bounds":{"upper":null,"lower":null}},"messure_bucket":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]},"category_bucket":{"doc_count_error_upper_bound":0,"sum_other_doc_count":0,"buckets":[]}}}.

Can anyone suggest what is the issue here? I am new to Magento and elasticsearch.

3
  • Have a look at this - magento.stackexchange.com/a/299677/34579 This will help you if ElasticSearch is returning results or not. Also, this answer may help you some or another way - magento.stackexchange.com/a/285358/34579
    – sandip
    Commented May 14, 2020 at 12:09
  • i had looked at those links, it helped to verify the elasticsearch output. web frontend says no results. the Magento query which i constructed and applied form curl did not provide any hits. But that is complex query for me to understand. Simple name search of item using curl returns results.
    – anuprasad
    Commented May 14, 2020 at 12:22
  • Did you end up fixing this?
    – addMitt
    Commented Dec 8, 2020 at 23:51

0

Your Answer

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

Browse other questions tagged or ask your own question.