Skip to content
Latchkey

OpenSearch "server is not a supported distribution" from the Elasticsearch client in CI

Newer official Elasticsearch clients check the server product header and refuse to run against anything that is not Elasticsearch, throwing "the server is not a supported distribution". OpenSearch forked from Elasticsearch, so the Elasticsearch client rejects it. The fix is to use the OpenSearch client, not the Elasticsearch one.

What this error means

Against an OpenSearch service container, the Elasticsearch client throws "The client noticed that the server is not a supported distribution. This functionality is not supported ...".

elasticsearch
elasticsearch.UnsupportedProductError: The client noticed that the server is not
Elasticsearch and we do not support this unknown product

Common causes

The Elasticsearch client enforces a product check

Recent Elasticsearch clients verify the X-elastic-product header and refuse to operate against a non-Elasticsearch server such as OpenSearch.

The test uses the wrong client for the server

The service container runs OpenSearch, but the test imports the Elasticsearch client library, so the two are incompatible.

How to fix it

Use the OpenSearch client

  1. Install the OpenSearch client for your language (for example opensearch-py).
  2. Point it at the OpenSearch service container.
  3. Replace the Elasticsearch client import in the tests.
python
from opensearchpy import OpenSearch
client = OpenSearch(hosts=[{"host": "localhost", "port": 9200}])
client.cluster.health(wait_for_status="yellow")

Match the client to the server product

Run the Elasticsearch client against Elasticsearch and the OpenSearch client against OpenSearch; do not mix them, since the product check blocks the mismatch.

How to prevent it

  • Choose the client that matches the server distribution.
  • When migrating from Elasticsearch to OpenSearch, switch client libraries too.
  • Pin the client so a version bump does not add or change the product check unexpectedly.

Frequently asked questions

What causes ""the server is not a supported distribution""?
Recent Elasticsearch clients verify the X-elastic-product header and refuse to operate against a non-Elasticsearch server such as OpenSearch.
How do I fix "the server is not a supported distribution"?
Use the OpenSearch client

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card