Smile-SA / smile-magento-elasticsearch

Magento ElasticSearch Implementation
151 stars 90 forks source link

Problem on reindex magento #57

Closed andy1786 closed 8 years ago

andy1786 commented 8 years ago

Hello,

I am not able to make this work.

curl -X GET 'http://localhost:9200/magentomattca/'

{"magentomattca":{"aliases":{},"mappings":{"product":{"properties":{"attribute_set_id":{"type":"long"},"categories":{"type":"long"},"category_name_ro":{"type":"string"},"created_at":{"type":"string"},"entity_id":{"type":"long"},"entity_type_id":{"type":"long"},"has_discount_0_1":{"type":"boolean"},"has_discount_1_1":{"type":"boolean"},"has_discount_2_1":{"type":"boolean"},"has_discount_3_1":{"type":"boolean"},"has_options":{"type":"boolean"},"in_stock":{"type":"boolean"},"position":{"properties":{"category_id":{"type":"long"},"position":{"type":"long"}}},"price_0_1":{"type":"long"},"price_1_1":{"type":"long"},"price_2_1":{"type":"long"},"price_3_1":{"type":"long"},"required_options":{"type":"boolean"},"show_in_categories":{"type":"string"},"sku":{"type":"string"},"store_id":{"type":"long"},"type_id":{"type":"string"},"unique":{"type":"string"},"updated_at":{"type":"string"}}}},"settings":{"index":{"creation_date":"1457350472747","uuid":"NaFtk-9XQ0SiUAVAK8eDsQ","number_of_replicas":"1","number_of_shards":"5","version":{"created":"1070599"}}},"warmers":{}}}

curl -X GET 'http://localhost:9200/magentomattca/_settings'

{"magentomattca":{"settings":{"index":{"creation_date":"1457350472747","uuid":"NaFtk-9XQ0SiUAVAK8eDsQ","number_of_replicas":"1","number_of_shards":"5","version":{"created":"1070599"}}}}}

but for

php /home/mattca/public_html/shell/indexer.php -reindex catalogsearch_fulltext

I get

`Catalog Search Index index process unknown error: exception 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response [status code] 400 [reason phrase] Bad Request [url] http://localhost:9200/magentomattca/_settings' in /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Exception/BadResponseException.php:43 Stack trace:

0 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(145): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response))

1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))

2 /home/mattca/public_html/lib/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))

3 /home/mattca/public_html/lib/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'request.error', Object(Guzzle\Common\Event))

4 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(589): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('request.error', Object(Guzzle\Common\Event))

5 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(378): Guzzle\Http\Message\Request->processResponse(Array)

6 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/EntityEnclosingRequest.php(49): Guzzle\Http\Message\Request->setState('complete', Array)

7 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(303): Guzzle\Http\Message\EntityEnclosingRequest->setState('complete', Array)

8 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(257): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array)

9 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(240): Guzzle\Http\Curl\CurlMulti->processMessages()

10 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(224): Guzzle\Http\Curl\CurlMulti->executeHandles()

11 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(111): Guzzle\Http\Curl\CurlMulti->perform()

12 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMultiProxy.php(94): Guzzle\Http\Curl\CurlMulti->send()

13 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Client.php(284): Guzzle\Http\Curl\CurlMultiProxy->send()

14 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(198): Guzzle\Http\Client->send(Object(Guzzle\Http\Message\EntityEnclosingRequest))

15 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(189): Guzzle\Http\Message\Request->send()

16 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(104): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), '{"settings":{"n...')

17 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(166): Elasticsearch\Connections\GuzzleConnection->performRequest('PUT', '/magentomattca/...', Array, '{"settings":{"n...')

18 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('PUT', '/magentomattca/...', Array, Array)

19 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php(246): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()

20 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php(349): Elasticsearch\Namespaces\IndicesNamespace->putSettings(Array)

21 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php(449): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Index->_prepareIndex()

22 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Indexer/Fulltext.php(193): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Index->prepareNewIndex()

23 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(212): Smile_ElasticSearch_Model_Indexer_Fulltext->reindexAll()

24 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()

25 /home/mattca/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()

26 /home/mattca/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()

27 {main}

Next exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":"ElasticsearchIllegalArgumentException[Can't update [index.number_of_replicas] on closed indices [[magentomattca]] - can leave index in an unopenable state]","status":400}' in /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php:266 Stack trace:

0 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(194): Elasticsearch\Connections\GuzzleConnection->process4xxError(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Exception\ClientErrorResponseException), '{"settings":{"n...')

1 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(104): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), '{"settings":{"n...')

2 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(166): Elasticsearch\Connections\GuzzleConnection->performRequest('PUT', '/magentomattca/...', Array, '{"settings":{"n...')

3 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('PUT', '/magentomattca/...', Array, Array)

4 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php(246): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()

5 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php(349): Elasticsearch\Namespaces\IndicesNamespace->putSettings(Array)

6 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php(449): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Index->_prepareIndex()

7 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Indexer/Fulltext.php(193): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Index->prepareNewIndex()

8 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(212): Smile_ElasticSearch_Model_Indexer_Fulltext->reindexAll()

9 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()

10 /home/mattca/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()

11 /home/mattca/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()

12 {main}

`

afoucret commented 8 years ago

Hi Andy,

Looks like you are using a 2.x ElasticSearch server.

As explain in #53 we are not yet supporting ES 2.x.

Can you confirm the version of ES you are using ?

andy1786 commented 8 years ago

Hello,

My version is 1.7. I had installed 2 but I've remove it (I've found about that here on some issues)

`[root@mattca mattca]# curl -XGET 'localhost:9200'

{ "status" : 200, "name" : "magentomattca", "cluster_name" : "mattcamag", "version" : { "number" : "1.7.5", "build_hash" : "00f95f4ffca6de89d68b7ccaf80d148f1f70e4d4", "build_timestamp" : "2016-02-02T09:55:30Z", "build_snapshot" : false, "lucene_version" : "4.10.4" }, "tagline" : "You Know, for Search" } `

afoucret commented 8 years ago

I suspect the error message is not the same now you have downgraded the module.

Are all required ES plugins installed (especially analysis-icu and analysis-phonetic) ?

BR,

andy1786 commented 8 years ago

Are not installed. Can you please tell me how to install them because I have a centos server and is not working as I am trying from github pages?

andy1786 commented 8 years ago

I've installed those 2 and now is running. I think is good. I will come back with feedback. Thank you for your help!

afoucret commented 8 years ago

Sure,

The plugin install is located into /usr/share/elasticsearch/bin/ on a CentOS machine.

In order to install the both analys-icu and analys-phonetic plugins you have to run :

/usr/share/elasticsearch/bin/plugin install elasticsearch/elasticsearch-analysis-icu/2.7.0
/usr/share/elasticsearch/bin/plugin install elasticsearch/elasticsearch-analysis-phonetic/2.7.0

Then you can restart ES.

BR,

afoucret commented 8 years ago

If you are OK with this I will close the issue. The ES 2.x support will remain open in #53

andy1786 commented 8 years ago

Hello,

Now I have another error (I've change 2 times the alias from magento settings)

`Catalog Search Index index process unknown error: exception 'Guzzle\Http\Exception\ClientErrorResponseException' with message 'Client error response [status code] 400 [reason phrase] Bad Request [url] http://localhost:9200/_aliases' in /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Exception/BadResponseException.php:43 Stack trace:

0 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(145): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response))

1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))

2 /home/mattca/public_html/lib/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))

3 /home/mattca/public_html/lib/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(53): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'request.error', Object(Guzzle\Common\Event))

4 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(589): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('request.error', Object(Guzzle\Common\Event))

5 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(378): Guzzle\Http\Message\Request->processResponse(Array)

6 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/EntityEnclosingRequest.php(49): Guzzle\Http\Message\Request->setState('complete', Array)

7 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(303): Guzzle\Http\Message\EntityEnclosingRequest->setState('complete', Array)

8 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(257): Guzzle\Http\Curl\CurlMulti->processResponse(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Curl\CurlHandle), Array)

9 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(240): Guzzle\Http\Curl\CurlMulti->processMessages()

10 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(224): Guzzle\Http\Curl\CurlMulti->executeHandles()

11 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMulti.php(111): Guzzle\Http\Curl\CurlMulti->perform()

12 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Curl/CurlMultiProxy.php(94): Guzzle\Http\Curl\CurlMulti->send()

13 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Client.php(284): Guzzle\Http\Curl\CurlMultiProxy->send()

14 /home/mattca/public_html/lib/vendor/guzzle/http/Guzzle/Http/Message/Request.php(198): Guzzle\Http\Client->send(Object(Guzzle\Http\Message\EntityEnclosingRequest))

15 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(189): Guzzle\Http\Message\Request->send()

16 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(104): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), '{"actions":[{"a...')

17 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(166): Elasticsearch\Connections\GuzzleConnection->performRequest('POST', '/_aliases', Array, '{"actions":[{"a...')

18 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('POST', '/_aliases', Array, Array)

19 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php(1035): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()

20 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php(500): Elasticsearch\Namespaces\IndicesNamespace->updateAliases(Array)

21 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Indexer/Fulltext.php(197): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Index->installNewIndex()

22 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(212): Smile_ElasticSearch_Model_Indexer_Fulltext->reindexAll()

23 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()

24 /home/mattca/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()

25 /home/mattca/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()

26 {main}

Next exception 'Elasticsearch\Common\Exceptions\BadRequest400Exception' with message '{"error":"InvalidAliasNameException[[magentomattca2-20160307-135509] Invalid alias name [magentomattca2], an index exists with the same name as the alias]","status":400}' in /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php:266 Stack trace:

0 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(194): Elasticsearch\Connections\GuzzleConnection->process4xxError(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Exception\ClientErrorResponseException), '{"actions":[{"a...')

1 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php(104): Elasticsearch\Connections\GuzzleConnection->sendRequest(Object(Guzzle\Http\Message\EntityEnclosingRequest), '{"actions":[{"a...')

2 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(166): Elasticsearch\Connections\GuzzleConnection->performRequest('POST', '/_aliases', Array, '{"actions":[{"a...')

3 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(86): Elasticsearch\Transport->performRequest('POST', '/_aliases', Array, Array)

4 /home/mattca/public_html/lib/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Namespaces/IndicesNamespace.php(1035): Elasticsearch\Endpoints\AbstractEndpoint->performRequest()

5 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Resource/Engine/Elasticsearch/Index.php(500): Elasticsearch\Namespaces\IndicesNamespace->updateAliases(Array)

6 /home/mattca/public_html/app/code/community/Smile/ElasticSearch/Model/Indexer/Fulltext.php(197): Smile_ElasticSearch_Model_Resource_Engine_Elasticsearch_Index->installNewIndex()

7 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(212): Smile_ElasticSearch_Model_Indexer_Fulltext->reindexAll()

8 /home/mattca/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()

9 /home/mattca/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()

10 /home/mattca/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()

11 {main}

`

afoucret commented 8 years ago

This must be related to the previous error.

I would advice you to clean (delete) all index created while the setup was incorrect through :

curl -XDELETE "localhost:9200/magentomattca2*"

Then reindex and everything should be OK.

andy1786 commented 8 years ago

Hello,

Is working. Super. Thank you!

If I have some questions about the magento plugin, where can I address it?

I do not want to use the layer navigation that is from this plugin and I want to use mine.

afoucret commented 8 years ago

We provides two types of support :

As your main problem since solved, I close this issue.

Thank you for your feedback and using our module.