Global search doesn't work, again

I’m running v7.13.1, php v8.0 and ElasticSearch v7.17.8

I’ve been struggling with this for many days but PHP is not my league; it’s time to seek help, I hope someone can provide it.

Global Search became a must for me. Since the beginning I never could use it without the error felt by many, even with Basic Search:

An unknown error has occurred while performing the search. Contact an administrator if the problem persists. More information available in the logs.

Module search works, though. So, to see if I could make it work, I installed ElasticSearch on a separate server (I use TrueNas) and it is working well from the Command Line using Robo. By the way, Robo was asking for the Phar module which was not available for php74, at least at FreeBSD, and so I had to migrate to php80.

But the error persists. The suitecrm.log says:

Mon Feb 20 15:13:54 2023 [12231][1][FATAL] [ERROR] [SearchThrowableHandler] Type Error: SuiteCRM\Search\SearchResults::getRelatedId(): Return value must be of type string, null returned in /usr/local/www/apache24/data/crm/lib/Search/SearchResults.php:227

This might be caused by a setting on my config.php or a missed php module, which I cannot find documented.

The other problem, which is minor, on suitecrm.log:

Mon Feb 20 15:28:00 2023 [52281][1][FATAL] Job 3ced23eb-d92a-9e6a-7810-63f391beb855 (ElasticSearch indexer) failed in CRON run

and on php_errors.log:

[20-Feb-2023 15:28:00 Europe/Lisbon] PHP Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, SchedulersJob given in /usr/local/www/apache24/data/crm/modules/Schedulers/_AddJobsHere.php:909

But it was running well with php74.

I say this is minor because I can always use the manual trigger button, which works, after a change on the DB; it’s not very comfortable, though.

So, any help will be very much appreciated, thank you.