cancel
Showing results for 
Search instead for 
Did you mean: 

Elastic Search 6.5 on magento 2.3.4 giving no results

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 gives 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?

2 REPLIES 2

Re: Elastic Search 6.5 on magento 2.3.4 giving no results

Did you ever find a solution to this ? I'm having the same issue

Re: Elastic Search 6.5 on magento 2.3.4 giving no results

Do you have more than 10000 products in your catalog? I have similar issue. I don't know how to fix it, but it is related somehow to elasticsearch results size, which is 10000 by default. 

If you change "size":"10000" to "size":"100000" in your magento query most probably it will work.