Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error creating category in admin: catalog_product index does not exist yet. Make sure everything is reindexed. #667

Closed
careys7 opened this issue Dec 21, 2017 · 9 comments
Labels

Comments

@careys7
Copy link

careys7 commented Dec 21, 2017

Preconditions

Magento Version : EE 2.2.1

ElasticSuite Version : ^2.4.0 + Retailer

Environment : Developer

Third party modules : None

Steps to reproduce

  1. Admin > Catalog > Categories
  2. Click on Root Category
  3. Click on "Add Subcategory"

Expected result

  1. Category create form appears

Actual result

  1. The POST request to the following URL returns HTTP 500: https://domain/admin/virtualcategory/category_virtual/preview/ajax/1/key/351315ec7a4bec47d0aad1927ddbc1d91a6567a06af43c9a45f4dd9788ad02ed/?isAjax=true

Stack Trace:

1 exception(s):
Exception #0 (LogicException): catalog_product index does not exist yet. Make sure everything is reindexed.

Exception #0 (LogicException): catalog_product index does not exist yet. Make sure everything is reindexed.
#0 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration.php(161): Smile\ElasticsuiteCore\Index\IndexOperation->getIndexByName('catalog_product', 0)
#1 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/ContainerConfiguration.php(94): Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration->getIndex()
#2 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-core/Search/Request/Builder.php(150): Smile\ElasticsuiteCore\Search\Request\ContainerConfiguration->getIndexName()
#3 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php(583): Smile\ElasticsuiteCore\Search\Request\Builder->create(0, 'catalog_view_co...', 0, 0, NULL, Array, Array, Array, Array)
#4 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php(189): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->loadProductCounts()
#5 /var/www/current/src/generated/code/Smile/ElasticsuiteCatalog/Model/ResourceModel/Product/Fulltext/Collection/Interceptor.php(24): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->getSize()
#6 /var/www/current/src/vendor/magento/framework/Data/Collection.php(257): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->getSize()
#7 /var/www/current/src/generated/code/Smile/ElasticsuiteCatalog/Model/ResourceModel/Product/Fulltext/Collection/Interceptor.php(1636): Magento\Framework\Data\Collection->getLastPageNumber()
#8 /var/www/current/src/vendor/magento/framework/Data/Collection.php(243): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->getLastPageNumber()
#9 /var/www/current/src/generated/code/Smile/ElasticsuiteCatalog/Model/ResourceModel/Product/Fulltext/Collection/Interceptor.php(1623): Magento\Framework\Data\Collection->getCurPage(0)
#10 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php(484): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->getCurPage()
#11 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php(393): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->prepareRequest()
#12 /var/www/current/src/vendor/magento/framework/Data/Collection/AbstractDb.php(340): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->_renderFiltersBefore()
#13 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ResourceModel/Product/Fulltext/Collection.php(430): Magento\Framework\Data\Collection\AbstractDb->_renderFilters()
#14 /var/www/current/src/vendor/magento/module-eav/Model/Entity/Collection/AbstractCollection.php(909): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection->_renderFilters()
#15 /var/www/current/src/vendor/magento/module-catalog/Model/ResourceModel/Product/Collection.php(749): Magento\Eav\Model\Entity\Collection\AbstractCollection->load(false, false)
#16 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Catalog\Model\ResourceModel\Product\Collection->load()
#17 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(138): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->___callParent('load', Array)
#18 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(153): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->Magento\Framework\Interception\{closure}()
#19 /var/www/current/src/generated/code/Smile/ElasticsuiteCatalog/Model/ResourceModel/Product/Fulltext/Collection/Interceptor.php(377): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->___callPlugins('load', Array, Array)
#20 /var/www/current/src/vendor/magento/framework/Data/Collection.php(331): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->load()
#21 /var/www/current/src/generated/code/Smile/ElasticsuiteCatalog/Model/ResourceModel/Product/Fulltext/Collection/Interceptor.php(1688): Magento\Framework\Data\Collection->getItems()
#22 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php(130): Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor->getItems()
#23 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php(91): Smile\ElasticsuiteVirtualCategory\Model\Preview->getUnsortedProductData()
#24 /var/www/current/src/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Controller/Adminhtml/Category/Virtual/Preview.php(71): Smile\ElasticsuiteVirtualCategory\Model\Preview->getData()
#25 /var/www/current/src/generated/code/Smile/ElasticsuiteVirtualCategory/Controller/Adminhtml/Category/Virtual/Preview/Interceptor.php(24): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview->execute()
#26 /var/www/current/src/vendor/magento/framework/App/Action/Action.php(107): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor->execute()
#27 /var/www/current/src/vendor/magento/module-backend/App/AbstractAction.php(229): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#28 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#29 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(138): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor->___callParent('dispatch', Array)
#30 /var/www/current/src/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#31 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#32 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(153): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#33 /var/www/current/src/generated/code/Smile/ElasticsuiteVirtualCategory/Controller/Adminhtml/Category/Virtual/Preview/Interceptor.php(39): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor->___callPlugins('dispatch', Array, NULL)
#34 /var/www/current/src/vendor/magento/framework/App/FrontController.php(55): Smile\ElasticsuiteVirtualCategory\Controller\Adminhtml\Category\Virtual\Preview\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#35 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#36 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#37 /var/www/current/src/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#38 /var/www/current/src/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#39 /var/www/current/src/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#40 /var/www/current/src/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http->launch()
#41 /var/www/current/src/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#42 {main}

Indexes appear to exist, just not any for the admin store:

GET http://elasticsearch:9200/_cat/indices?v

health status index                                              pri rep docs.count docs.deleted store.size pri.store.size 
green  open   magento2_us_eng_thesaurus_20171221_023532            1   0          0            0       159b           159b 
green  open   magento2_au_eng_catalog_category_20171221_023531     1   0        693            0    491.7kb        491.7kb 
green  open   magento2_cn_eng_thesaurus_20171221_023532            1   0          0            0       159b           159b 
green  open   magento2_au_eng_catalog_product_20171221_023525      1   0       4900            0      1.5mb          1.5mb 
green  open   magento2_nz_eng_catalog_category_20171221_023531     1   0        458            0    375.3kb        375.3kb 
green  open   magento2_uk_eng_catalog_product_20171221_023527      1   0       3318            0        1mb            1mb 
green  open   magento2_uk_eng_thesaurus_20171221_023532            1   0          0            0       159b           159b 
green  open   magento2_otherstore_catalog_category_20171221_023532   1   0        458            0    375.2kb        375.2kb 
green  open   magento2_otherstore_catalog_product_20171221_023529    1   0          0            0       159b           159b 
green  open   magento2_uk_eng_catalog_category_20171221_023531     1   0        550            0    372.3kb        372.3kb 
green  open   magento2_otherstore_thesaurus_20171221_023532          1   0          0            0       159b           159b 
green  open   magento2_cn_eng_catalog_product_20171221_023529      1   0        113            0     70.1kb         70.1kb 
green  open   magento2_nz_eng_thesaurus_20171221_023532            1   0          0            0       159b           159b 
green  open   magento2_cn_eng_catalog_category_20171221_023532     1   0        229            0    167.4kb        167.4kb 
green  open   magento2_us_eng_catalog_category_20171221_023531     1   0        241            0    187.1kb        187.1kb 
green  open   magento2_au_eng_thesaurus_20171221_023532            1   0          0            0       159b           159b 
green  open   magento2_nz_eng_catalog_product_20171221_023523      1   0       5183            0      1.6mb          1.6mb 
green  open   magento2_us_eng_catalog_product_20171221_023528      1   0       2375            0    726.3kb        726.3kb 

Screenshot:

screen shot 2017-12-21 at 5 23 36 pm

@afoucret
Copy link
Contributor

afoucret commented Jan 4, 2018

@careys7

Did you set "Single Store Mode: OFF" ?

@careys7
Copy link
Author

careys7 commented Jan 8, 2018

Yes that's correct. We are using a migrated database.

See below

screen shot 2018-01-08 at 2 51 16 pm

If you know what might be wrong, a pointer would be appreciated and we can investigate on this end

@afoucret
Copy link
Contributor

afoucret commented Jan 8, 2018

Found it !!!

It is very probable that the root category you want to create a new category under is not assigned to any store view. One possible solution would be to disable merchandising (product list preview and sorting) on such a category.

Will try to provide a patch tomorrow for this one.
Can you test it (without changing your store configuration) after it will be available ?

@careys7
Copy link
Author

careys7 commented Jan 8, 2018

Awesome. Yes, will be happy to test 👍

@afoucret
Copy link
Contributor

afoucret commented Jan 9, 2018

PR #683 should fix this one.
Warning : you need to clear your browser cache for this being applied because there is a small JS update to be applied.

Will merge it in branches 2.4.x and master and release a new stable version (2.4.4).

@afoucret
Copy link
Contributor

afoucret commented Jan 9, 2018

PR have been merged.

@careys7
Copy link
Author

careys7 commented Jan 10, 2018

thanks @afoucret - I created a patch from your PR but this didn't cleanly apply (I assume there is other changes we are missing).

Is 2.2.4 far away, or am I best to wait for the release to test?

@afoucret
Copy link
Contributor

I close the issue since PR have been merged.
Will be part of 2.4.4

Do you confirm the patch fix the issue ?

@careys7
Copy link
Author

careys7 commented Feb 9, 2018

I've just re-tested this on 2.5.0, and it's working great! Thanks for the fix

screen shot 2018-02-09 at 5 36 02 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants