Smile-SA / smile-magento-elasticsearch

Magento ElasticSearch Implementation
151 stars 90 forks source link

Error when no results in autocomplete #97

Open kilianyp opened 7 years ago

kilianyp commented 7 years ago

Hi, when there are no results in autocomplete, I get the following error:

{"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed; shardFailures {[p8o9JZNGSoievT-pMdwJEg][magentotest-20170205-074729][0]: SearchParseException[[magentotest-20170205-074729][0]: from[-1],size[-1]: Parse Failure [Failed to parse source [{\"query\":{\"filtered\":{\"query\":{\"bool\":{\"must\":[{\"function_score\":{\"query\":{\"bool\":{\"must\":[{\"multi_match\":{\"query\":\"din 912 \\u00f6lk\",\"type\":\"best_fields\",\"minimum_should_match\":\"100%\"}}],\"should\":[{\"multi_match\":{\"query\":\"din 912 \\u00f6lk\",\"type\":\"best_fields\",\"tie_breaker\":1,\"fields\":[\"autocomplete_de.edge_ngram_front\",\"category_name_de.edge_ngram_front^1\"],\"analyzer\":\"analyzer_de\"}}]}},\"functions\":[{\"filter\":{\"query\":{\"query_string\":{\"query\":\"din 912 \\u00f6lk\",\"default_field\":\"autocomplete_de.whitespace\"}}},\"boost_factor\":10}]}}]}},\"filter\":{\"bool\":{\"must\":[{\"terms\":{\"visibility\":[3,4]}},{\"terms\":{\"status\":[1]}},{\"terms\":{\"store_id\":[1]}}],\"_cache\":true}}}},\"fields\":[\"entity_id\"],\"track_scores\":true,\"sort\":[{\"_score\":\"desc\"}],\"from\":0,\"size\":\"3\"}]]]; nested: QueryParsingException[[magentotest-20170205-074729] No fields specified for multi_match query]; }]","status":400}<br />
Trace:
#0 /html/magento/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(194): Elasticsearch\Connections\GuzzleConnection-&gt;process4xxError(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Exception\ClientErrorResponseException), '{&quot;query&quot;:{&quot;filt...')
#1 /html/magento/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(104): Elasticsearch\Connections\GuzzleConnection-&gt;sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), '{&quot;query&quot;:{&quot;filt...')
#2 /html/magento/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(161): Elasticsearch\Connections\GuzzleConnection-&gt;performRequest('GET', 'http://35.157.1...', Array, '{&quot;query&quot;:{&quot;filt...')
#3 /html/magento/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(85): Elasticsearch\Transport-&gt;performRequest('GET', '/magentotest/pr...', Array, '{&quot;query&quot;:{&quot;filt...')
#4 /html/magento/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(1010): Elasticsearch\Endpoints\AbstractEndpoint-&gt;performRequest()
#5 /html/magento/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Query/Abstract.php(219): Elasticsearch\Client-&gt;search(Array)
#6 /html/magento/app/code/community/Smile/ElasticSearch/Model/Resource/Catalog/Product/Collection.php(227): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Query_Abstract-&gt;search()
#7 /html/magento/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php(864): Smile_ElasticSearch_Model_Resource_Catalog_Product_Collection-&gt;_beforeLoad()
#8 /html/magento/lib/Varien/Data/Collection.php(301): Mage_Eav_Model_Entity_Collection_Abstract-&gt;load()
#9 /html/magento/app/design/frontend/base/default/template/smile/elasticsearch/autocomplete/suggest/product.phtml(19): Varien_Data_Collection-&gt;getItems()
#10 /html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/html/magento/a...')
#11 /html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('frontend/base/d...')
#12 /html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView()
#13 /html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Template-&gt;_toHtml()
#14 /html/magento/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract-&gt;toHtml()
#15 /html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Text_List-&gt;_toHtml()
#16 /html/magento/app/code/core/Mage/Core/Block/Abstract.php(641): Mage_Core_Block_Abstract-&gt;toHtml()
#17 /html/magento/app/code/core/Mage/Core/Block/Abstract.php(585): Mage_Core_Block_Abstract-&gt;_getChildHtml('complete_list', true)
#18 /html/magento/app/design/frontend/base/default/template/smile/elasticsearch/autocomplete/autocomplete.phtml(17): Mage_Core_Block_Abstract-&gt;getChildHtml('complete_list')
#19 /html/magento/app/code/core/Mage/Core/Block/Template.php(241): include('/html/magento/a...')
#20 /html/magento/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('frontend/base/d...')
#21 /html/magento/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView()
#22 /html/magento/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Template-&gt;_toHtml()
#23 /html/magento/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract-&gt;toHtml()
#24 /html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout-&gt;getOutput()
#25 /html/magento/app/code/community/Smile/ElasticSearch/controllers/AjaxController.php(49): Mage_Core_Controller_Varien_Action-&gt;renderLayout()
#26 /html/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Smile_ElasticSearch_AjaxController-&gt;suggestAction()
#27 /html/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action-&gt;dispatch('suggest')
#28 /html/magento/app/code/community/ArtsOnIT/OfflineMaintenance/Controller/Router/Standard.php(46): Mage_Core_Controller_Varien_Router_Standard-&gt;match(Object(Mage_Core_Controller_Request_Http))
#29 /html/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(172): ArtsOnIT_OfflineMaintenance_Controller_Router_Standard-&gt;match(Object(Mage_Core_Controller_Request_Http))
#30 /html/magento/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front-&gt;dispatch()
#31 /html/magento/app/Mage.php(683): Mage_Core_Model_App-&gt;run(Array)
#32 /html/magento/index.php(85): Mage::run('', 'store')
#33 {main}

When I actually execute the search, no error is thrown. It only affects the autocomplete form. I am using ES 1.72 on amazon aws.

Your plugin runs on PHP 7.0. Thank you