Nodes are reported as indexed even when the search cluster is down

Created on 1 February 2022, over 3 years ago
Updated 17 September 2025, 19 days ago

Problem/Motivation

This module does not properly handle exceptions from the ElasticSearch PHP library - exceptions thrown are caught and printed to console, but the connector then reports back to Search API saying the index was successful.

This results in the index tracker in Drupal and what's actually in Elasticsearch (when it comes back online) being out of sync, since nodes are marked as up to date in the tracker.

Steps to reproduce

1) Either make content changes in Drupal or clear the search index.
2) Break the connection between Drupal and ES (e.g stop the ElasticSearch containers on a local deployment).
3) Trigger a search index via the drush sapi-i command.
4) The index is reported as successful even though ElasticSearch cannot be reached.
5) Make ElasticSearch available again, then trigger another index via Drush.
6) Nodes that failed to index are not written to ElasticSearch.

Proposed resolution

ElasticSearch Connector should either throw a SearchApiException so that the error can be handled correctly by Search API itself or report than no nodes were indexed. This will prevent the tracker from being updated so Search API will keep trying to index the content.

🐛 Bug report
Status

Needs review

Component

Elasticsearch Connector

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024