Backend / Databases / NOSQL / Elasticsearch / 07_opensearch_and_the_fork.md

OpenSearch and the fork

Updated 5 interview angles 4 min read source
On this page6
  1. What happened, in order
  2. Licence, and why AGPL is not a non-issue
  3. What actually differs in your code
  4. Choosing
  5. Related
  6. Interview angle

OpenSearch and the fork

Ads name both, often in the same line, and the question behind it is whether you know they are the same codebase five years apart — and which half of the difference actually affects your code.

Verified 2026-08

Verified 2026-08. Re-check before quoting a licence; this area has moved twice already.

What happened, in order

When What
2021 Elastic drops Apache 2.0 for SSPL / Elastic Licence
2021 AWS forks Elasticsearch 7.10 as OpenSearch, Apache 2.0
Aug 2024 Elastic adds AGPLv3 as an option, calling it a return to open source
Sep 2024 OpenSearch donated to the Linux Foundation
2025-26 OpenSearch 3.x ships independently; the two are peers, not copies

The shape is identical to Redis → Valkey and Terraform → OpenTofu: a licence change aimed at cloud vendors, answered with a foundation-governed fork. See Valkey.

The 2024 events are the ones that date a candidate. Saying “Elasticsearch isn’t open source” has been wrong since AGPL was added; saying “OpenSearch is just an AWS project” has been wrong since the Linux Foundation took it.

Licence, and why AGPL is not a non-issue

Elasticsearch OpenSearch
Licence AGPLv3, SSPL or Elastic Apache 2.0
Governance Elastic Linux Foundation
Paid tier features behind subscription no licence tiers

Apache 2.0 is permissive. AGPLv3 is copyleft over a network, which is the practical difference: modify Elasticsearch and expose it as a service and the obligation to publish your modifications attaches. Most teams run it unmodified and are unaffected — but legal review in a product company frequently lands on Apache 2.0 for exactly this reason, and being able to say why is the senior answer.

What actually differs in your code

Almost nothing, and that is the useful part:

python
# Elasticsearch
from elasticsearch import Elasticsearch
es = Elasticsearch("https://localhost:9200", api_key=KEY)

# OpenSearch — same shape, different package
from opensearchpy import OpenSearch
os_ = OpenSearch(hosts=[{"host": "localhost", "port": 9200}],
                 http_auth=("admin", PASSWORD))

Query DSL, mappings, aggregations and the bulk API are the same at the level these notes cover — everything in Elasticsearch — Query DSL and BM25 Scoring and Elasticsearch — Aggregations applies to both.

Gotcha: use the matching client. elasticsearch-py 8+ refuses to talk to OpenSearch — it sends a product-verification header and errors with “the client noticed that the server is not Elasticsearch”. That check exists deliberately; pinning elasticsearch-py<7.14 to defeat it is a workaround people reach for and should not.

Where they have genuinely diverged is the layer above search:

Area Elasticsearch OpenSearch
Dashboards Kibana OpenSearch Dashboards
Security X-Pack, tiered included, Apache 2.0
Vector search dense_vector, ES|QL k-NN plugin, ML Commons
Managed on AWS Elastic Cloud Amazon OpenSearch Service

Security is the one worth naming: field- and document-level security is a paid Elastic feature and a free OpenSearch one. In a regulated tenant that single row can decide the choice.

json
// OpenSearch: role-based field masking, no subscription.
{
  "index_permissions": [{
    "index_patterns": ["patients*"],
    "masked_fields": ["nhs_number"],
    "dls": "{\"term\": {\"tenant\": \"acme\"}}"
  }]
}

dls filters which documents a role sees and masked_fields hashes values it may not read. Building the same thing yourself — a filter every query must remember to apply — is the alternative, and it fails the first time someone forgets.

Choosing

Usually you do not — the platform decided. Amazon OpenSearch Service is the managed offering on AWS, so an AWS-native shop lands on OpenSearch by default, and the same is true in reverse for Elastic Cloud.

What would change it:

  • Licence policy. An organisation that will not take AGPL dependencies.
  • A specific feature. ES|QL and Elastic’s newer relevance work versus OpenSearch’s ML Commons and free security.
  • Existing Kibana dashboards, which do not port cleanly.

And for vector search specifically, both are viable but neither is the obvious answer — see Elasticsearch — Vector Search and kNN and Vector Databases.

Interview angle 5

  • “Elasticsearch or OpenSearch?” - same codebase forked from 7.10 in 2021 and diverged since. Usually the platform decides: Amazon OpenSearch Service on AWS, Elastic Cloud otherwise. Licence policy or a specific feature is what would override that.
  • “What’s the licence situation now?” - OpenSearch is Apache 2.0 under the Linux Foundation since September 2024. Elasticsearch added AGPLv3 as an option in August 2024, so “Elasticsearch isn’t open source” is out of date — but AGPL is network copyleft, which is why some legal reviews still land on Apache.
  • “Does your application code change?” - barely. Query DSL, mappings, aggregations and bulk are the same. You must use the matching client: elasticsearch-py 8+ sends a product-verification header and refuses to talk to OpenSearch.
  • “Where have they actually diverged?” - the layer above search. Kibana against OpenSearch Dashboards, X-Pack against a bundled Apache-licensed security plugin, and different vector-search stacks. Field- and document-level security being free on OpenSearch decides regulated deployments.
  • “Why did AWS fork it at all?” - the 2021 SSPL change restricted offering the software as a managed service, which is precisely AWS’s business. Same reason and same answer as Redis to Valkey and Terraform to OpenTofu.