INTRODUCTION
The Search API ElasticSearchKit Proxy module is a Drupal module that acts as a proxy to handle Elasticsearch search requests. It integrates with the elasticsearch_connector
and search_api
modules to dynamically configure and manage Elasticsearch clusters and servers. The module supports decoupled architectures by enabling a React app to communicate with the Drupal backend for search functionality.
The primary use cases for this module are:
- Proxy Elasticsearch Requests: Centralize Elasticsearch queries through a Drupal controller for better control and security.
- Decoupled Search App Integration: Provide a secure API endpoint for React or other decoupled front-end applications.
- Supports Authentication: Manage both anonymous and Basic Authentication for Elasticsearch clusters.
FEATURES
- Extendable Controller: The module allows you to extend the controller in your custom module. This enables you to modify Elasticsearch queries and the returned JSON results to suit your specific requirements.
- Proxy Elasticsearch Requests: Securely act as a proxy for Elasticsearch queries, allowing front-end applications to perform searches without exposing sensitive data.
- Framework Agnostic: Works seamlessly with any frontend (e.g., React, Vue) in decoupled setups.
- Advanced Security: Adds filtering and security features to the Elasticsearch requests.
REQUIREMENTS
This module depends on the following modules and services:
- elasticsearch_search_api
- elasticsearch_connector
- search_api
- A working Elasticsearch instance and open CORS in
elasticsearch.yml
- A decoupled React, Vue search application
INSTALLATION
Install the module as you would normally install a contributed Drupal module. See: Drupal Module Installation Guide for further information.
This depends on Elasticsearch - Search API which in turn depends on elasticsearch_connector and search_api
- Install required module using Composer:
composer require drupal/search_api_elasticsearchkit_proxy
- Enable the module via the Drupal admin UI or Drush:
drush en search_api_elasticsearchkit_proxy
CONFIGURATION
-
Step 1: Configure your Elasticsearch connection in the
elasticsearch_connector
settings at/admin/config/search/elasticsearch-connector
. -
Step 2: Set up a search index using Elasticsearch as the backend via the
search_api
module at/admin/config/search/search-api
. -
Step 3: Configure the proxy settings in the Search API ElasticSearchKit Proxy module at
/admin/config/search/elasticsearch-proxy-server
. - Step 4: Ensure your React app points to the Drupal proxy endpoint for search queries.
REACT_APP_ELASTICSEARCH_HOST=https://example.com/api/search
MAINTAINERS
Current maintainers for Drupal 10:
- Mohammad Fayoumi (mohammad-fayoumi) - https://www.drupal.org/u/mohammad-fayoumi
- Vardot (vardot) - https://www.drupal.org/vardot