Skip to content

[Core] Provide a way to see in admin indexing error from bulk request #3604

@rbayet

Description

@rbayet

Is your feature request related to a problem? Please describe.
Documents (product/categories) can be rejected when indexed.
An error message will be logged which indicates some or all the ids of the rejected documents, for instance

[2025-05-19T14:27:20.923312+00:00] report.ERROR: Bulk index operation failed 1 times in index magento2_hyva_catalog_product_20250519_142720 for type _doc. Error (mapper_parsing_exception) : failed to parse field
 [created_at] of type [date] in document with id '2003'. Preview of field's value: 'true'. Failed doc ids sample : 2003.

This was generated by adding $indexData[$parentId]['created_at'] = true; in \Smile\ElasticsuiteCatalog\Model\Product\Indexer\Fulltext\Datasource\AttributeData::addData to forcefully generate an indexing error (trying to send a boolean value to a field expecting only a formatted date).

    /**
     * {@inheritdoc}
     */
    public function addData($storeId, array $indexData)
    {
        $productIds   = array_keys($indexData);
        $indexData    = $this->addAttributeData($storeId, $productIds, $indexData);

        $relationsByChildId = $this->resourceModel->loadChildrens($productIds, $storeId);

        if (!empty($relationsByChildId)) {
            $allChildrenIds      = array_keys($relationsByChildId);
            [...]

            foreach ($relationsByChildId as $childId => $relations) {
                foreach ($relations as $relation) {
                    $parentId = (int) $relation['parent_id'];
                    [...]
                    $indexData[$parentId]['created_at'] = true;
                }
            }
        }

        return $this->filterCompositeProducts($indexData);
    }

The issue is that those errors are mostly silent outside of the Magento logs and on some projects, particularly those PIM / custom import driven, badly declared attributes will lead to some products "not appearing on the site" due to those silent indexing errors.

Describe the solution you'd like

A way to report in the admin interface those indexing bulk errors with some context provided

  • date/timestamp
  • the entity type (product, categories, ...)
  • the error message
  • most importantly the list / sample of problematic doc ids

We can imagine that those errors are recorded in a DB table when they occur / are detected but purged before every [entity type] full reindex.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions