PreviousNext: Introducing Search API OpenSearch

This year a fork of Elasticsearch was created called OpenSearch. The reasons behind it are varied, and I’m not going to get into that side of things other than to say there are two sides to every story, and it didn’t end well.

Our Skpr hosting platform offers a managed AWS Elasticsearch service. As a result of the split, AWS has deprecated Elasticsearch and is migrating all of its managed services to OpenSearch.

This left us in a bit of a difficult situation.

In this blog post, we explain our rationale for choosing to fork Elasticsearch Connector and create a new Search API OpenSearch module.

by kim.pepper / 8 December 2021

At PreviousNext, a number of our projects are currently using the Elasticsearch Connector module. This module is based on the Elasticsearch PHP library, as well as a PHP wrapper library. The module has been around since 2013, supports Drupal 7, 8 and 9 and has almost 5000 reported sites using it.

Unfortunately, the Elasticsearch client library that Elasticsearch Connector uses, will only connect to OpenSearch at version 7.10.2 and below. This means there is a limited amount of support for this library on OpenSearch going forward, and users will need to pin their versions to avoid incompatibilities. This also means users will not be able to take advantage of new features, bug fixes and security updates.

To avoid this issue, the OpenSearch project forked PHP Elasticsearch client library and created a new  opensearch-php  client library.

Trying to support two different PHP client libraries would require some major rewriting of Elasticsearch Connector module and potentially another bridge library. It seemed like it would be more trouble than it was worth.

There was only one real option left: we would need to fork Elasticsearch Connector and create a new module: Search API OpenSearch.

After posting an issue on the Elasticsearch issues list declaring our intentions to fork the module with the maintainers, we set about the task of rewriting the structure of the module. Key goals were:

  • Clear separation of responsibilities for code
  • Use dependency injection wherever possible
  • Avoid static methods
  • Ensure a high-level of unit and kernel test code coverage
  • Start with the basic features

Elasticsearch Connector provides two config entities: Cluster and Index, for storing configuration. It then wraps these to support Search API. In our module, we wanted to simplify this and leverage the existing Search API Server and Index config entities directly, and tie ourselves more cleanly into the Search API ecosystem.

We also recognised there are many different hosting providers that have their own way of authenticating connections, so we created a new Connector plugin type with basic auth supported out of the box, to allow 3rd-party modules to easily add their own.

Our initial goal, is to provide basic indexing and search functionality. So far the module supports:

  • Indexing, including mapping fields
  • Searching
  • Views
  • Search Pages
  • Facets
  • More Like This

We hope to make the module as extendable as possible via services, events and plugins so that you can shape it to suit your specific needs.

Please try it out, and let us know if you find any issues by posting to the issue queue!

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

PreviousNext: Introducing Search API OpenSearch

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.