diff --git a/src/EventSubscriber/DefaultSubscriber.php b/src/EventSubscriber/DefaultSubscriber.php
index 4dba019..1d74e19 100644
--- a/src/EventSubscriber/DefaultSubscriber.php
+++ b/src/EventSubscriber/DefaultSubscriber.php
@@ -2,6 +2,8 @@
 
 namespace Drupal\elasticsearch_connector_autocomp\EventSubscriber;
 
+use Drupal\Component\Utility\NestedArray;
+Symfony\Contracts\EventDispatcher\Event;
 use Drupal\Core\Database\Connection;
 use Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory;
 use Drupal\Core\Entity\EntityTypeManagerInterface;
@@ -53,7 +55,7 @@ class DefaultSubscriber implements EventSubscriberInterface {
   /**
    * Called on elasticsearch_connector.prepare_index_mapping event.
    *
-   * @param \Symfony\Component\EventDispatcher\Event $event
+   * @param \Symfony\Contracts\EventDispatcher\Event $event
    *   The event.
    */
   public function elasticsearchConnectorPrepareIndexMapping(Event $event) {
@@ -84,7 +86,7 @@ class DefaultSubscriber implements EventSubscriberInterface {
   /**
    * Called on elasticsearch_connector.prepare_index event.
    *
-   * @param \Symfony\Component\EventDispatcher\Event $event
+   * @param \Symfony\Contracts\EventDispatcher\Event $event
    *   The event.
    */
   public function elasticsearchConnectorPrepareIndex(Event $event) {
@@ -122,7 +124,7 @@ class DefaultSubscriber implements EventSubscriberInterface {
 EOF;
 
       $body = json_decode($body, TRUE);
-      $indexConfig['body'] = array_merge($indexConfig['body'], $body);
+      $indexConfig['body'] = NestedArray::mergeDeepArray([$indexConfig['body'], $body]);
     }
 
     $event->setIndexConfig($indexConfig);
