elasticsuite: Search Usage Analytics - tracking_log_session index does not exist yet - 2.11.1

I have seen a previously raised issue regarding this, however the issue that I am having can be traced to an error in the indexing.

The elasticsuite_tracker_log_event table is being populated with front end visit information as expected, the cronjob is being attempted, but fails with the following error in the cron log:

main.ERROR: Cron Job elasticsuite_index_log_event has an error: Warning: Undefined array key “date” in /html/vendor/smile/elasticsuite/src/module-elasticsuite-tracker/Model/EventIndex.php on line 79.

Which is the line:

$date = substr($event['date'], 0, 7);

From this function:

public function indexEvents($events)
    {
        $bulk    = $this->indexOperation->createBulk();
        $indices = [];
        foreach ($events as $event) {
            if (isset($event['page']['store_id'])) {
                $date = substr($event['date'], 0, 7);
                $index = $this->indexResolver->getIndex(self::INDEX_IDENTIFIER, $event['page']['store_id'], $date);
                if ($index !== null) {
                    $event = $this->mappingEnforcer->enforce($index, $event);
                    $indices[$index->getName()] = $index;
                    $bulk->addDocument($index, $event['event_id'], $event);
                }
            }
        }
        if ($bulk->isEmpty() === false) {
            $this->indexOperation->executeBulk($bulk);
        }
        foreach ($indices as $index) {
            $this->indexOperation->refreshIndex($index);
        }
    }

This in turn makes the cron job fail and the index never appear.

Magento Version : 2.4.6 ElasticSuite Version : 2.11.1 Environment : Developer Elasticsearch 7.17

Third party modules : Mirasvit Cache Warmer BSS Commerce Out of stock Notification BSS Commerce B2B Registration BSS Commerce Hide Price Xtento Product Feed Export Module

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 24

Commits related to this issue

Most upvoted comments

I tagged a 2.11.1.1

Thank you everyone

@vahonc excellent thanks, I’ll create a patch and test it out

@chrisbadley,

It looks like there really is a certain bug here, especially when using Magento 2.4.6. Of course, we tested the compatibility of our module, but it seems that we somehow missed this problem. Apparently, this is my fault 🤦.

I will try to discuss this problem with the team tomorrow morning and prepare a PR and fixes to this.

BR, Vadym

Can’t catch them all, but as long as you are aware that half the battle dealt with.