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

Unable to load Root Categories into ElasticSearch after a sub category was added #3192

Open
brian-vdb opened this issue Feb 21, 2024 · 4 comments
Assignees

Comments

@brian-vdb
Copy link

Preconditions

While I was analyzing the interactions between ElasticSearch and ElasticSuite that are performed to handle data in the database, I came to the point where I wanted to know more about the category index mapping. After I created a single custom category in Magento 2, the reindexing and cache cleaning still worked fine, but when I tried loading the categories page, it gave an error. So I decided to query ElasticSearch for the category mappings and it returned only the new entry for the custom category. All of the root categories including "Default Category" were deleted from the Search Engine and not added back or updated.

Magento Version : 2.4.6

ElasticSuite Version : 2.11.5.1

Environment : Developer

Third party modules : markshust/magento2-module-disabletwofactorauth

Steps to reproduce

  1. Install a new Magento 2.4.6 instance that uses markshust/magento2-module-disabletwofactorauth, ElasticSuite 2.11.5.1 and ElasticSearch 7.17.5. The PHP version on which I worked was 8.2-fpm. The installation steps can be viewed below.
  2. reindex and clean cache.
  3. On the admin panel, navigate to "CATALOG -> Categories"
  4. Click on "Add Subcategory" and fill in the required fields. I named the category "Shirts".
  5. If the page still renders, try performing a reindex and cache clean.

Expected result

  1. A sub-category should be created to assign products to

Actual result

  1. Error on Frontend:

frontend

  1. Database Content:

database-content

  1. Category mapping contents:
GET brian.local:9200/magento2_default_catalog_category/_search?scroll=1m
Content-Type: application/json
Accept: application/json

{
  "size": 1000,
  "query": {
    "match_all": {}
  }
}
HTTP/1.1 200 OK
X-elastic-product: Elasticsearch
content-type: application/json; charset=UTF-8
content-encoding: gzip
content-length: 503

{
    "_scroll_id": "FGluY2x1ZGVfY29udGV4dF91dWlkDXF1ZXJ5QW5kRmV0Y2gBFnZIcWo4LVJuUWx5Y1Z2WDBEc19vekEAAAAAAAAANBZyUFRuSkNTTFJseWFpRXI1eWJHN1RR",
    "took": 14,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 1,
            "relation": "eq"
        },
        "max_score": 1.0,
        "hits": [
            {
                "_index": "magento2_default_catalog_category_20240221_133048",
                "_type": "_doc",
                "_id": "3",
                "_score": 1.0,
                "_source": {
                    "entity_id": "3",
                    "attribute_set_id": "3",
                    "parent_id": "2",
                    "created_at": "2024-02-21 13:40:14",
                    "updated_at": "2024-02-21 13:40:14",
                    "path": "1\/2\/3",
                    "position": "1",
                    "level": "2",
                    "children_count": "0",
                    "is_active": "1",
                    "is_displayed_in_autocomplete": [
                        true
                    ],
                    "option_text_is_displayed_in_autocomplete": [
                        "Display Category in Autocomplete"
                    ],
                    "name": [
                        "Shirts"
                    ],
                    "url_key": [
                        "shirts"
                    ],
                    "url_path": [
                        "shirts"
                    ]
                }
            }
        ]
    }
}
  1. Default Category contents:
GET brian.local:9200/magento2_default_catalog_category/_doc/2
HTTP/1.1 404 Not Found
X-elastic-product: Elasticsearch
content-type: application/json; charset=UTF-8
content-encoding: gzip
content-length: 112

{
    "_index": "magento2_default_catalog_category_20240221_134453",
    "_type": "_doc",
    "_id": "2",
    "found": false
}
  1. System Logs on Page Render
[2024-02-21T15:10:31.587437+00:00] main.INFO: Broken reference: the 'tracking' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.588674+00:00] main.INFO: Broken reference: the 'notification_area' element cannot be added as child to 'notifications', because the latter doesn't exist [] []
[2024-02-21T15:10:31.589440+00:00] main.INFO: Broken reference: the 'unread_system_messages' element cannot be added as child to 'notifications', because the latter doesn't exist [] []
[2024-02-21T15:10:31.590290+00:00] main.INFO: Broken reference: the 'notification_window' element cannot be added as child to 'notifications', because the latter doesn't exist [] []
[2024-02-21T15:10:31.591085+00:00] main.INFO: Broken reference: the 'notification.messages' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.591710+00:00] main.INFO: Broken reference: the 'global_notices' element cannot be added as child to 'global.notices', because the latter doesn't exist [] []
[2024-02-21T15:10:31.592528+00:00] main.INFO: Broken reference: the 'logo' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.593287+00:00] main.INFO: Broken reference: the 'global.search' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.593856+00:00] main.INFO: Broken reference: the 'user' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.594456+00:00] main.INFO: Broken reference: the 'menu' element cannot be added as child to 'page.menu', because the latter doesn't exist [] []
[2024-02-21T15:10:31.595039+00:00] main.INFO: Broken reference: the 'breadcrumbs' element cannot be added as child to 'page.breadcrumbs', because the latter doesn't exist [] []
[2024-02-21T15:10:31.595586+00:00] main.INFO: Broken reference: the 'formkey' element cannot be added as child to 'page.formkey', because the latter doesn't exist [] []
[2024-02-21T15:10:31.596142+00:00] main.INFO: Broken reference: the 'page.title' element cannot be added as child to 'main.top', because the latter doesn't exist [] []
[2024-02-21T15:10:31.596791+00:00] main.INFO: Broken reference: the 'messages' element cannot be added as child to 'page.messages', because the latter doesn't exist [] []
[2024-02-21T15:10:31.597352+00:00] main.INFO: Broken reference: the 'page.actions.toolbar' element cannot be added as child to 'page.main.actions', because the latter doesn't exist [] []
[2024-02-21T15:10:31.597872+00:00] main.INFO: Broken reference: the 'legal' element cannot be added as child to 'footer', because the latter doesn't exist [] []
[2024-02-21T15:10:31.598590+00:00] main.INFO: Broken reference: the 'header.inner.left' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.599165+00:00] main.INFO: Broken reference: the 'header.inner.right' element cannot be added as child to 'header', because the latter doesn't exist [] []
[2024-02-21T15:10:31.599855+00:00] main.INFO: Broken reference: the 'user' tries to reorder itself towards '', but their parents are different: 'header' and '' respectively. [] []
[2024-02-21T15:10:31.600418+00:00] main.INFO: Broken reference: the 'notification.messages' tries to reorder itself towards 'user', but their parents are different: 'header' and '' respectively. [] []
[2024-02-21T15:10:31.600985+00:00] main.INFO: Broken reference: the 'logo' tries to reorder itself towards '', but their parents are different: 'header' and '' respectively. [] []
[2024-02-21T15:10:31.601538+00:00] main.INFO: Broken reference: the 'global.search' tries to reorder itself towards 'logo', but their parents are different: 'header' and '' respectively. [] []
[2024-02-21T15:10:31.602087+00:00] main.INFO: Broken reference: the 'page.actions.toolbar' tries to reorder itself towards '', but their parents are different: 'page.main.actions' and '' respectively. [] []
[2024-02-21T15:10:31.603354+00:00] main.INFO: Broken reference: the 'header.inner.left' tries to reorder itself towards '', but their parents are different: 'header' and '' respectively. [] []
[2024-02-21T15:10:31.603981+00:00] main.INFO: Broken reference: the 'header.inner.right' tries to reorder itself towards 'header.inner.left', but their parents are different: 'header' and '' respectively. [] []
[2024-02-21T15:10:31.604790+00:00] main.INFO: Broken reference: the 'notification.messages' tries to reorder itself towards 'user', but their parents are different: 'header.inner.right' and '' respectively. [] []
[2024-02-21T15:10:36.981332+00:00] main.INFO: Broken reference: the 'notification.messages' tries to reorder itself towards 'user', but their parents are different: 'header.inner.right' and 'header' respectively. [] []
[2024-02-21T15:10:42.745754+00:00] main.INFO: Broken reference: the 'notification.messages' tries to reorder itself towards 'user', but their parents are different: 'header.inner.right' and 'header' respectively. [] []
[2024-02-21T15:10:46.366684+00:00] main.ERROR: The "is_virtual_category" attribute name is invalid. Reset the name and try again. [] []
[2024-02-21T15:10:46.487345+00:00] main.ERROR: The "is_virtual_category" attribute name is invalid. Reset the name and try again. [] []
@vahonc
Copy link
Collaborator

vahonc commented Feb 27, 2024

Hello @brian-vdb,

Have you run the bin/magento setup:upgrade command? Were there any errors during its execution?

Are you sure that you don't disable any ElasticSuite modules, especially the module-elasticsuite-virtual-category?

BR,
Vadym

@brian-vdb
Copy link
Author

brian-vdb commented Feb 27, 2024 via email

@brian-vdb
Copy link
Author

brian-vdb commented Feb 28, 2024 via email

@vahonc
Copy link
Collaborator

vahonc commented Mar 4, 2024

@brian-vdb,

I will try to reproduce your issue according to your steps on this week.

BR,
Vadym

@rbayet rbayet assigned vahonc and unassigned brian-vdb Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants