Keploy as a Elasticsearch testing framework
Keploy mocks Elasticsearch by recording its REST API traffic beneath your client, capturing search hits, aggregations, and index responses exactly as the cluster returned them, then replaying those in tests. No cluster runs in CI and no index has to be created.
keploy record -c "./search-service"What Keploy gives a Elasticsearch team
Captured at the Elasticsearch REST API
Keploy records the HTTP exchange beneath your client, so a search replays with the exact hits, scores, and aggregation buckets the cluster computed — not a hand-written approximation of them.
- Below the Java, Python, JS, and Go clients
- Hits, scores, and _source preserved
- Aggregation buckets captured
- Bulk index responses recorded
Why Elasticsearch integration tests slow teams down
The friction is rarely the assertions. It is everything around them — spinning up dependencies, keeping mocks honest, and repairing tests after every refactor.
Testing Elasticsearch: by hand, with Testcontainers Elasticsearch, or with Keploy
A real cluster gives true relevance and aggregation semantics, at the cost of a heavy container and a refresh wait. Keploy records those responses once and replays them instantly.
Select any row for the full comparison, with code.
What you write for Elasticsearch vs what Keploy records
All three produce the same assertion. Only the third still passes after the next refactor without anyone editing it.
The query body is discarded, so a wrong field name, a missing analyzer, or an inverted filter returns the expected hits and passes.
Real relevance and mappings — and it needs a large image, a green cluster, an index mapping, and an explicit refresh production never performs.
The score came from the cluster's own index statistics, and the response is tied to the exact query body that produced it.
Times are estimates for authoring one endpoint’s coverage from scratch, not measurements.
Elasticsearch testing tools, compared
The options a team on caches and search stores actually reaches for, and where each one genuinely wins. Select a row for the full comparison.
Assessments reflect each tool’s documented behaviour, not benchmark measurements.
Record your Elasticsearch app once, replay it forever
Keploy sits below your Elasticsearch process at the network layer. It watches the calls your app already makes, then serves them back on replay so tests run with no dependencies attached.
Keploy records a GET call to /api/v1/orders/{id} on a Elasticsearch service and captures the dependency calls it makes.
Elasticsearch clients Keploy records, driver by driver
Keploy captures Elasticsearch at the wire protocol, so 5 of these 7 clients need no adapter, no test double, and no Elasticsearch instance in CI.
- Auto-mocked
PythonView page
the elasticsearch-py client
- Auto-mocked
JavaView page
the Elasticsearch Java API client and Spring Data
- Auto-mocked
Node.jsView page
@elastic/elasticsearch
- Auto-mocked
GoView page
go-elasticsearch
- Auto-mocked
OpenSearch
The same REST API surface, so capture is identical
- Partial
.NETView page
Elastic.Clients.Elasticsearch
- Partial
RubyView page
the elasticsearch-ruby client
Your first Elasticsearch test suite in under five minutes
Every command below runs against your existing Elasticsearch service. Nothing in your source tree changes.
1Install the Keploy CLI
A single binary. It needs a Linux kernel with eBPF support, or Docker on macOS and Windows — and it adds nothing to your project's dependencies.
curl -sSL https://keploy.io/install.sh | bash2Record your service
Pass the command you already use to start the app. Keploy runs it and watches every socket it opens.
keploy record -c "./search-service"3Exercise the paths you care about
Run the app against your development cluster. Every search and index call, with the response the cluster computed, is captured together.
curl 'localhost:8080/search?state=NEW'curl 'localhost:8080/search/summary?group_by=state'4Replay in CI
Replay serves the recorded dependency responses, so the job needs no service containers and no Docker daemon.
keploy test -c "./search-service" --delay 10
Ready to try it on your own Elasticsearch service?
Works with the rest of your Elasticsearch stack
Keploy records at the network layer, so framework and driver choices inside your Elasticsearch app do not change how it captures traffic.
Python
elasticsearch-py traffic records at the REST layer.
Java
The Java API client and Spring Data Elasticsearch record identically.
Node.js
@elastic/elasticsearch calls record with full responses.
OpenSearch
API-compatible, so recordings work without changes.
Redis
The cache page covers RESP-level capture in depth.
Docker
Record in a container or on the host; replay needs neither.
Testing the rest of your stack
- Caches & Stores
Keploy as a Redis testing framework
Record RESP traffic once and replay real cache hits, misses, TTLs, and pipeline responses without a Redis server in CI.
Read the guide - Databases
Keploy as a PostgreSQL testing framework
Record the Postgres frontend/backend protocol once and replay real result sets in tests — no container, no pg-mem, no schema to rebuild.
Read the guide - Languages
Keploy as a Python testing framework
Turn the requests your Python service already handles into a pytest-grade regression suite, with every dependency mocked from the recording.
Read the guide - Languages
Keploy as a Java testing framework
Generate JUnit-grade integration tests for any JVM service by recording the traffic it already serves.
Read the guide - Languages
Keploy as a Node.js testing framework
Replace nock registrations and in-memory database fixtures with tests recorded from the traffic your Node service already serves.
Read the guide - Message Queues
Keploy as a Apache Kafka testing framework
Test producers and consumers against recorded broker exchanges — no embedded Kafka, no Testcontainers cluster, no flaky poll loops.
Read the guide
Join our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“Best report of integration and API tests I've seen — which we don't get from RestAssured.”
G2“Future of microservices testing. I don't write tests now!”
G2 · 5/5“An amazing product that simplifies the automation.”
Gartner · 4.0