diff --git a/3178307-10-re-index-all-levels-and-performance-issues.patch b/3178307-10-re-index-all-levels-and-performance-issues.patch
new file mode 100644
index 00000000..24b2cf41
--- /dev/null
+++ b/3178307-10-re-index-all-levels-and-performance-issues.patch
@@ -0,0 +1,121 @@
+diff --git a/config/schema/search_api.index.schema.yml b/config/schema/search_api.index.schema.yml
+index 02ce5d32..51be9462 100644
+--- a/config/schema/search_api.index.schema.yml
++++ b/config/schema/search_api.index.schema.yml
+@@ -82,6 +82,9 @@ search_api.index.*:
+         index_directly:
+           type: boolean
+           label: 'Index items immediately'
++        index_entity_references:
++          type: boolean
++          label: 'Index entity references automatically'
+     server:
+       type: string
+       label: 'Server ID'
+diff --git a/search_api.install b/search_api.install
+index 5aa7a178..049963ea 100644
+--- a/search_api.install
++++ b/search_api.install
+@@ -330,3 +330,25 @@ function search_api_update_8106() {
+     // exception. (Site could also use an alternate key/value store.)
+   }
+ }
++
++/**
++ * Enable index entity references option by default on existing indexes.
++ */
++function search_api_update_8107() {
++  // This update function updates search indexes for the change from
++  // https://www.drupal.org/project/search_api/issues/3178307.
++  $config_factory = \Drupal::configFactory();
++
++  foreach ($config_factory->listAll('search_api.index.') as $index_id) {
++    $index = $config_factory->getEditable($index_id);
++    $options = $index->get('options');
++    $options['index_entity_references'] = TRUE;
++    $index->set('options', $options);
++
++    // Mark the resulting configuration as trusted data. This avoids issues
++    // with future schema changes.
++    $index->save(TRUE);
++  }
++
++  return t('Enabled "Index entity references" on existing indexes.');
++}
+\ No newline at end of file
+diff --git a/src/Entity/Index.php b/src/Entity/Index.php
+index 221b3fb9..2cd3f9b4 100644
+--- a/src/Entity/Index.php
++++ b/src/Entity/Index.php
+@@ -1221,6 +1221,7 @@ class Index extends ConfigEntityBase implements IndexInterface {
+     $this->options += [
+       'cron_limit' => $config->get('default_cron_limit'),
+       'index_directly' => TRUE,
++      'index_entity_references' => TRUE,
+     ];
+   }
+ 
+@@ -1263,6 +1264,7 @@ class Index extends ConfigEntityBase implements IndexInterface {
+     $this->options += [
+       'cron_limit' => $config->get('default_cron_limit'),
+       'index_directly' => TRUE,
++      'index_entity_references' => TRUE,
+     ];
+ 
+     // Reset the static cache for getPropertyDefinitions() to make sure we don't
+diff --git a/src/Form/IndexForm.php b/src/Form/IndexForm.php
+index 56150455..7e6cadf8 100644
+--- a/src/Form/IndexForm.php
++++ b/src/Form/IndexForm.php
+@@ -322,6 +322,12 @@ class IndexForm extends EntityForm {
+       '#description' => $this->t('Immediately index new or updated items instead of waiting for the next cron run. This might have serious performance drawbacks and is generally not advised for larger sites.'),
+       '#default_value' => $index->getOption('index_directly'),
+     ];
++    $form['options']['index_entity_references'] = [
++      '#type' => 'checkbox',
++      '#title' => $this->t('Index entity references automatically'),
++      '#description' => $this->t('Index entities that references the entity being updated. This might have serious performance drawbacks and is generally not advised for larger sites.'),
++      '#default_value' => $index->getOption('index_entity_references'),
++    ];
+     $form['options']['cron_limit'] = [
+       '#type' => 'textfield',
+       '#title' => $this->t('Cron batch size'),
+diff --git a/src/IndexInterface.php b/src/IndexInterface.php
+index f2a23515..5aece22a 100644
+--- a/src/IndexInterface.php
++++ b/src/IndexInterface.php
+@@ -81,6 +81,8 @@ interface IndexInterface extends ConfigEntityInterface {
+    * - cron_limit: The maximum number of items to be indexed per cron batch.
+    * - index_directly: Boolean setting whether entities are indexed immediately
+    *   after they are created or updated.
++   * - index_entity_references: Boolean setting whether entities referecing the
++   *   updated entity should be indexed/re-indexed or not.
+    *
+    * @return array
+    *   An associative array of option values, keyed by the option name.
+diff --git a/src/Utility/TrackingHelper.php b/src/Utility/TrackingHelper.php
+index 9d9ac87c..4bb46c25 100644
+--- a/src/Utility/TrackingHelper.php
++++ b/src/Utility/TrackingHelper.php
+@@ -106,6 +106,11 @@ class TrackingHelper implements TrackingHelperInterface {
+     // actually need it.
+     $original = $deleted ? NULL : $entity->original ?? NULL;
+     foreach ($indexes as $index) {
++      // Do not index entity references if the option has been disabled.
++      if (!$index->getOption('index_entity_references')) {
++        continue;
++      }
++      
+       $map = NULL;
+       foreach ($index->getDatasources() as $datasource_id => $datasource) {
+         if (!$datasource->canContainEntityReferences()) {
+@@ -212,8 +217,7 @@ class TrackingHelper implements TrackingHelperInterface {
+         }
+ 
+         $entity_reference = $this->isEntityReferenceDataDefinition($property_definition, $cacheability);
+-        if ($entity_reference
+-            && $relation_info['entity_type'] !== $entity_reference['entity_type']) {
++        if ($entity_reference) {
+           $relation_info = $entity_reference;
+           $relation_info['property_path_to_foreign_entity'] = implode(IndexInterface::PROPERTY_PATH_SEPARATOR, $seen_path_chunks);
+         }
diff --git a/3178307-2-re-index-does-not-work-for-all-levels-of-references.patch b/3178307-2-re-index-does-not-work-for-all-levels-of-references.patch
new file mode 100644
index 00000000..a740407c
--- /dev/null
+++ b/3178307-2-re-index-does-not-work-for-all-levels-of-references.patch
@@ -0,0 +1,14 @@
+diff --git a/src/Utility/TrackingHelper.php b/src/Utility/TrackingHelper.php
+index 9d9ac87c..9c84048e 100644
+--- a/src/Utility/TrackingHelper.php
++++ b/src/Utility/TrackingHelper.php
+@@ -212,8 +212,7 @@ class TrackingHelper implements TrackingHelperInterface {
+         }
+ 
+         $entity_reference = $this->isEntityReferenceDataDefinition($property_definition, $cacheability);
+-        if ($entity_reference
+-            && $relation_info['entity_type'] !== $entity_reference['entity_type']) {
++        if ($entity_reference) {
+           $relation_info = $entity_reference;
+           $relation_info['property_path_to_foreign_entity'] = implode(IndexInterface::PROPERTY_PATH_SEPARATOR, $seen_path_chunks);
+         }
diff --git a/config/schema/search_api.index.schema.yml b/config/schema/search_api.index.schema.yml
index 02ce5d32..51be9462 100644
--- a/config/schema/search_api.index.schema.yml
+++ b/config/schema/search_api.index.schema.yml
@@ -82,6 +82,9 @@ search_api.index.*:
         index_directly:
           type: boolean
           label: 'Index items immediately'
+        index_entity_references:
+          type: boolean
+          label: 'Index entity references automatically'
     server:
       type: string
       label: 'Server ID'
diff --git a/search_api.install b/search_api.install
index 5aa7a178..049963ea 100644
--- a/search_api.install
+++ b/search_api.install
@@ -330,3 +330,25 @@ function search_api_update_8106() {
     // exception. (Site could also use an alternate key/value store.)
   }
 }
+
+/**
+ * Enable index entity references option by default on existing indexes.
+ */
+function search_api_update_8107() {
+  // This update function updates search indexes for the change from
+  // https://www.drupal.org/project/search_api/issues/3178307.
+  $config_factory = \Drupal::configFactory();
+
+  foreach ($config_factory->listAll('search_api.index.') as $index_id) {
+    $index = $config_factory->getEditable($index_id);
+    $options = $index->get('options');
+    $options['index_entity_references'] = TRUE;
+    $index->set('options', $options);
+
+    // Mark the resulting configuration as trusted data. This avoids issues
+    // with future schema changes.
+    $index->save(TRUE);
+  }
+
+  return t('Enabled "Index entity references" on existing indexes.');
+}
\ No newline at end of file
diff --git a/src/Entity/Index.php b/src/Entity/Index.php
index 090131de..2eb305b2 100644
--- a/src/Entity/Index.php
+++ b/src/Entity/Index.php
@@ -1227,6 +1227,7 @@ class Index extends ConfigEntityBase implements IndexInterface {
     $this->options += [
       'cron_limit' => $config->get('default_cron_limit'),
       'index_directly' => TRUE,
+      'index_entity_references' => TRUE,
     ];
   }
 
@@ -1269,6 +1270,7 @@ class Index extends ConfigEntityBase implements IndexInterface {
     $this->options += [
       'cron_limit' => $config->get('default_cron_limit'),
       'index_directly' => TRUE,
+      'index_entity_references' => TRUE,
     ];
 
     // Reset the static cache for getPropertyDefinitions() to make sure we don't
diff --git a/src/Form/IndexForm.php b/src/Form/IndexForm.php
index 56150455..7e6cadf8 100644
--- a/src/Form/IndexForm.php
+++ b/src/Form/IndexForm.php
@@ -322,6 +322,12 @@ class IndexForm extends EntityForm {
       '#description' => $this->t('Immediately index new or updated items instead of waiting for the next cron run. This might have serious performance drawbacks and is generally not advised for larger sites.'),
       '#default_value' => $index->getOption('index_directly'),
     ];
+    $form['options']['index_entity_references'] = [
+      '#type' => 'checkbox',
+      '#title' => $this->t('Index entity references automatically'),
+      '#description' => $this->t('Index entities that references the entity being updated. This might have serious performance drawbacks and is generally not advised for larger sites.'),
+      '#default_value' => $index->getOption('index_entity_references'),
+    ];
     $form['options']['cron_limit'] = [
       '#type' => 'textfield',
       '#title' => $this->t('Cron batch size'),
diff --git a/src/IndexInterface.php b/src/IndexInterface.php
index f2a23515..5aece22a 100644
--- a/src/IndexInterface.php
+++ b/src/IndexInterface.php
@@ -81,6 +81,8 @@ interface IndexInterface extends ConfigEntityInterface {
    * - cron_limit: The maximum number of items to be indexed per cron batch.
    * - index_directly: Boolean setting whether entities are indexed immediately
    *   after they are created or updated.
+   * - index_entity_references: Boolean setting whether entities referecing the
+   *   updated entity should be indexed/re-indexed or not.
    *
    * @return array
    *   An associative array of option values, keyed by the option name.
diff --git a/src/Utility/TrackingHelper.php b/src/Utility/TrackingHelper.php
index 088211ac..9749b542 100644
--- a/src/Utility/TrackingHelper.php
+++ b/src/Utility/TrackingHelper.php
@@ -105,6 +105,11 @@ class TrackingHelper implements TrackingHelperInterface {
     // Original entity, if available.
     $original = $deleted ? NULL : ($entity->original ?? NULL);
     foreach ($indexes as $index) {
+      // Do not index entity references if the option has been disabled.
+      if (!$index->getOption('index_entity_references')) {
+        continue;
+      }
+
       // Map of foreign entity relations. Will get lazily populated as soon as
       // we actually need it.
       $map = NULL;
