Change record status: 
Introduced in branch: 
8.x-7.x
Introduced in version: 
8.x-7.0-alpha6
Description: 

For the 8.0.x release series, we decided to largely mirror the structure of the code in the Search API OpenSearch module, in order to make both projects more maintainable. See #3270464: Investigate search_api_opensearch as base for elasticsearch_connector for more information.

Following the Search API OpenSearch module's structure allows us to more-easily share code between both projects, and makes it easier for Elasticsearch Connector users to build on other innovations in the Search API ecosystem. However, resulted in many changes from elasticsearch_connector:8.x-7.0-alpha6.

Hooks

hook_elasticsearch_connector_supported_data_types_alter()

The hook_elasticsearch_connector_supported_data_types_alter() hook is used to modify the list of supported data types in the elasticsearch_connector:8.x-7.x release series. But, it has been deprecated in elasticsearch_connector:8.x-7.0-alpha6 and has been removed from elasticsearch_connector:8.0.0. To modify the list of supported data types, Elasticsearch Connector 8.0.0 instead uses the Search API module's data types.

See the full hook_elasticsearch_connector_supported_data_types_alter change record for more information.

hook_elasticsearch_connector_load_library_options_alter()

The hook_elasticsearch_connector_load_library_options_alter() hook is used to modify the connector library options in the elasticsearch_connector:8.x-7.x release series. But, it has been deprecated in elasticsearch_connector:8.x-7.0-alpha6 and has been removed from elasticsearch_connector:8.0.0. To modify the connector library options, Elasticsearch Connector 8.0.0 uses Drupal's plugin API to define connection types.

See the full hook_elasticsearch_connector_load_library_options_alter() change record for more information.

elasticsearch_connector_views submodule

Elasticsearch Connector 8.0.0 provides out-of-box superb Views integration with many features with test coverage.

Events

BuildIndexParamsEvent

The \Drupal\elasticsearch_connector\Event\BuildIndexParamsEvent event is used to allow other modules to alter index params before they are sent.

@todo

BuildSearchParamsEvent

The \Drupal\elasticsearch_connector\Event\BuildSearchParamsEvent event is used to allow other modules to alter search parameters before a query is created.

A similar event in the 8.0.x and 9.0.x release series' is \Drupal\elasticsearch_connector\Event\AlterSearchQueryParamsEvent

@todo

PrepareIndexEvent

The \Drupal\elasticsearch_connector\Event\PrepareIndexEvent event is used to allow other modules to alter index configuration before an index is created.

The 8.0.x branch has two events that run when an index is created:

  1. \Drupal\elasticsearch_connector\Event\IndexPreCreateEvent, which runs before the index is created, and
  2. \Drupal\elasticsearch_connector\Event\IndexCreatedEvent, which runs after the index is created

In some use-cases, AlterSettingsEvent might also work for you, see #3433226: Add index to AlterSettingsEvent for backward compatibility.

Elasticsearch Connector 8.x-7.x code Elasticsearch Connector 8.0.x code

Old code in src/EventSubscriber/MyEventSubscriber.php:

  namespace Drupal\mymodule\EventSubscriber

  use Drupal\elasticsearch_connector\Event\PrepareIndexEvent;
  use Symfony\Component\EventDispatcher\EventSubscriberInterface;

  class MyEventSubscriber implements EventSubscriberInterface {
    public static function getSubscribedEvents(): array {
      $events['elasticsearch_connector.prepare_index'] = ['myFunction'];
      return $events;
    }

    public function myFunction(PrepareIndexEvent $event): void {
      $indexConfig = $event->getIndexConfig();

      // Change default index settings.
      $indexConfig['body']['settings']['number_of_shards'] = 10;
      $indexConfig['body']['settings']['number_of_replicas'] = 2;

      // Add a custom analyzer.
      $indexConfig['body']['analysis']['analyzer']['my_analyzer'] = [
        /* ... */
      ];

      $event->setIndexConfig($indexConfig);
    }
  }

New code in src/EventSubscriber/MyEventSubscriber.php:

  namespace Drupal\mymodule\EventSubscriber

  use Drupal\elasticsearch_connector\Event\AlterSettingsEvent;
  use Drupal\elasticsearch_connector\Event\IndexPreCreateEvent;
  use Symfony\Component\EventDispatcher\EventSubscriberInterface;

  class MyEventSubscriber implements EventSubscriberInterface {
    public static function getSubscribedEvents(): array {
      $events[IndexPreCreateEvent::class] = ['indexPreCreate'];
      $events[AlterSettingsEvent::class] = ['alterSettings'];
      return $events;
    }

    public function indexPreCreate(IndexPreCreateEvent $event): void {
      $params = $event->getParams();
      $params['settings']['max_ngram_diff'] = 25;
      $event->setParams($params);
      self::$params = $event->getParams();
    }

    public function alterSettings(AlterSettingsEvent $event): void {
      $settings = $event->getSettings();

      // Add a custom analyzer.
      $settings['analysis']['analyser']['my_analyzer'] = [
        /* ... */
      ];

      $event->setSettings($settings);
    }
  }

PrepareIndexMappingEvent

The \Drupal\elasticsearch_connector\Event\PrepareIndexMappingEvent event is used to allow other modules to alter index mapping configuration before it is saved.

@todo

PrepareMappingEvent

The \Drupal\elasticsearch_connector\Event\PrepareMappingEvent event is used to allow other modules to alter mapping configuration before it is saved.

@todo \Drupal\elasticsearch_connector\Event\FieldMappingEvent is an equivalent?

PrepareSearchQueryEvent

The \Drupal\elasticsearch_connector\Event\PrepareSearchQueryEvent event is used to allow other modules to alter search queries before they are sent.

@todo

Services

elasticsearch_connector.client_factory

The elasticsearch_connector.client_factory service and its class \nodespark\DESConnector\ClientFactory has been deprecated in elasticsearch_connector:8.x-7.0-alpha6 and has been removed from elasticsearch_connector:8.0.0. @todo

elasticsearch_connector.client_manager

The elasticsearch_connector.client_manager service and its class \Drupal\elasticsearch_connector\ElasticSearch\ClientManager has been deprecated in elasticsearch_connector:8.x-7.0-alpha6 and has been removed from elasticsearch_connector:8.0.0. @todo

elasticsearch_connector.cluster_manager

The elasticsearch_connector.cluster_manager service and its class \Drupal\elasticsearch_connector\ClusterManager has been deprecated in elasticsearch_connector:8.x-7.0-alpha6 and has been removed from elasticsearch_connector:8.0.0. @todo

elasticsearch_connector.index_factory

The elasticsearch_connector.index_factory service and its class \Drupal\elasticsearch_connector\ElasticSearch\Parameters\Factory\IndexFactory has been deprecated in elasticsearch_connector:8.x-7.0-alpha6 and has been removed from elasticsearch_connector:8.0.0. @todo

Other classes

Many classes that were present in elasticsearch_connector:8.x-7.0-alpha6 were removed. The full list of classes removed in elasticsearch_connector:8.0.0 is:

  1. modules/elasticsearch_connector_views/src/Plugin/views/ElasticsearchViewsHandlerTrait.php
  2. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsBoolean.php
  3. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsDate.php
  4. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsEntity.php
  5. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsEntityField.php
  6. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsFieldTrait.ph
  7. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsMarkup.php
  8. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsNumeric.php
  9. modules/elasticsearch_connector_views/src/Plugin/views/field/ElasticsearchViewsStandard.php
  10. modules/elasticsearch_connector_views/src/Plugin/views/filter/ElasticsearchViewsBooleanOperator.php
  11. modules/elasticsearch_connector_views/src/Plugin/views/filter/ElasticsearchViewsDate.php
  12. modules/elasticsearch_connector_views/src/Plugin/views/filter/ElasticsearchViewsFulltextSearch.php
  13. modules/elasticsearch_connector_views/src/Plugin/views/filter/ElasticsearchViewsNumericFilte.php
  14. modules/elasticsearch_connector_views/src/Plugin/views/filter/ElasticsearchViewsStandard.php
  15. modules/elasticsearch_connector_views/src/Plugin/views/filter/ElasticsearchViewsStringFilter.php
  16. modules/elasticsearch_connector_views/src/Plugin/views/join/ElasticsearchViewsJoin.php
  17. modules/elasticsearch_connector_views/src/Plugin/views/query/ElasticsearchViewsQuery.php
  18. src/ClusterManager.php
  19. src/Controller/ClusterListBuilder.php
  20. src/Controller/ElasticsearchController.php
  21. src/ElasticSearch/ClientManager.php
  22. src/ElasticSearch/ClientManagerInterface.php
  23. src/ElasticSearch/Parameters/Builder/SearchBuilder.php
  24. src/ElasticSearch/Parameters/Factory/FilterFactory.php
  25. src/ElasticSearch/Parameters/Factory/IndexFactory.php
  26. src/ElasticSearch/Parameters/Factory/MappingFactory.php
  27. src/ElasticSearch/Parameters/Factory/SearchFactory.php
  28. src/Entity/Cluster.php
  29. src/Entity/ClusterRouteProvider.php
  30. src/Entity/Index.php
  31. src/Entity/IndexRouteProvider.php
  32. src/Event/BuildIndexParamsEvent.php
  33. src/Event/BuildSearchParamsEvent.php
  34. src/Event/PrepareIndexEvent.php
  35. src/Event/PrepareIndexMappingEvent.php
  36. src/Event/PrepareMappingEvent.php
  37. src/Event/PrepareSearchQueryEvent.php
  38. src/Exception/ElasticSearchConnectorException.php
  39. src/Form/ClusterDeleteForm.php
  40. src/Form/ClusterForm.php
  41. src/Form/IndexDeleteForm.php
  42. src/Form/IndexForm.php
  43. src/Plugin/search_api/backend/SearchApiElasticsearchBackend.php
  44. src/Plugin/search_api/backend/SearchApiElasticsearchBackendInterface.php
  45. src/Plugin/search_api/processor/ExcludeSourceFields.php

(note that this list excludes test classes)

Impacts: 
Site builders, administrators, editors
Module developers