Nodes not get indexed after running manual cron


I’m experiencing some unexpected behavior of cron. I have used search_api module, that should index all nodes. Automatic cron is set to 1 hour. So after every hour, cron will run automatically.

So, the issue is, I created node, and search its content, it is not searchable.

I ran cron, then searched again, still its not searchable.

After 2-3 times hitting cron manually, the content becomes searchable.

Although, for 1-2 content types, content will become searchable after hitting cron for the first time.

I have total 4 content types, and 100 nodes in my whole site.

Forcefully running cron after 3-4 times, make nodes content searchable, else my nodes are not searchable.

Is it the known issue of Drupal core or what would be the problem, I’m not able to figure out as why nodes are not getting indexed automatically? Even after cron run for Ist time, nodes not get indexed.

Any help is really appreciated.

Module used: Search_api (version = 8.x-1.5)

Note: I can’t used updated version of search_api as of now, because my current version of Drupal is 8.3.6, and latest release of search_api module is not compatible with this older Drupal version.

I have written a custom cron too, to run cron after node gets created, but this is also not solving this late cron run issue.

function mymodule_cron() {
  $nids = Drupal::entityQuery('node')
    ->condition('created', array(time()-3600, time()), 'BETWEEN')
  // Load all the nodes.
  $nodes = Node::loadMultiple($nids);
  foreach ($nodes as $node) {

قالب وردپرس