Skip to content
CAI
Software that uses CAICheck a score

Philippus/elastic4s

53.5

Adequate · 27 September 2026

26.7k

lines of production code

Scala

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Elastic4s is a Scala client library for Elasticsearch that provides a type-safe, fluent DSL for constructing and executing search queries, aggregations, and index management operations. It supports multiple asynchronous HTTP transport backends, including Akka, Pekko, http4s, sttp, and ZIO, allowing integration with various functional effect systems. The library handles comprehensive JSON serialization via Jackson, Circe, and other libraries, and includes utilities for reactive streaming and integration testing.

How it got here

2013–2018 — Modernization and comprehensive test coverage

51 changes.

The project underwent a significant architectural overhaul, migrating to SBT 2.0, supporting Scala 3, and refactoring the core client to use generic effect types for broader async library integration. This period also saw the expansion of HTTP client implementations, the addition of new JSON serialization modules, and the introduction of explicit authentication support. A massive effort was dedicated to establishing robust test coverage across all API endpoints, including search, aggregations, and cluster management, ensuring reliability for the updated codebase.

2019–2021 — Scala 3 and Elasticsearch 8 migration

42 changes.

The codebase underwent a comprehensive rewrite to support Scala 3 and align with Elasticsearch 8.x, including a complete domain model restructuring and a migration from Jackson 2 to Jackson 3. This period involved refactoring the architecture into modular traits and dedicated handler modules, while expanding feature coverage for aggregations, security, and streaming operations.

2022–2026 — Pekko migration and API expansion

25 changes.

This period focused on migrating the HTTP client and reactive streams infrastructure to Apache Pekko, while introducing new clients for http4s and ZIO HTTP. It also expanded the library's feature set by adding handlers for Elasticsearch APIs such as Point-in-Time, Synonyms, Terms Enum, and Index Lifecycle Management, alongside comprehensive test coverage for these additions.

Features

Add Pekko Streams integration for Elasticsearch

This release introduces a new \elastic4s-streams-pekko\ module providing Pekko Streams integration for Elasticsearch. It adds \ElasticSource\ for streaming search results via scroll cursors and \BatchElasticSink\ for bulk indexing operations. The implementation includes a fix for \ElasticSource\ to prevent premature stream completion when buffered hits remain after an empty prefetched scroll page, ensuring all documents are delivered to the consumer.

elastic4s-streams-pekko · high confidence

Add ZIO 1.x JSON integration module

Introduces the elastic4s-json-zio-1 module, providing implicit conversions for ZIO 1.x's zio-json library. This adds support for serializing and deserializing documents via Indexable, HitReader, AggReader, and ParamSerializer instances, allowing users to leverage zio-json for JSON handling within the ZIO 1.x ecosystem.

elastic4s-json-zio-1 · high confidence

Add ZIO effect type class instances

The elastic4s-effect-zio module now provides implicit type class instances for ZIO, starting with a Functor implementation for zio.Task. This allows users to leverage ZIO's effect system within elastic4s operations, enabling seamless integration of ZIO-based error handling and effect composition.

elastic4s-effect-zio/src/main · high confidence

Add handler for reload search analyzers API

Users can now invoke the Elasticsearch reload search analyzers endpoint via the client. This change introduces the handler implementation that constructs the POST request to the /{index}/\_reload\_search\_analyzers endpoint and processes the HTTP response, mapping 200 and 404 status codes to successful responses while treating other codes as errors.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/reloadsearchanalyzers · high confidence

Add serverInfo request handler

A new handler for the MainRequest has been introduced, enabling the retrieval of server information. This handler constructs a GET request to the root endpoint (/) and processes the HTTP response, returning the parsed MainResponse on a 200 status code or raising an error for other status codes.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/main · high confidence

Add support for Point-in-Time (PIT) API handlers

The library now includes handler implementations for the Elasticsearch Point-in-Time API, enabling users to create and delete PITs via the client. This change adds the \PitHandlers\ trait which registers HTTP request builders for creating a PIT on a specific index (supporting a \keep\_alive\ parameter) and deleting a PIT by ID, along with the necessary request/response types and JSON builder logic.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/pit · high confidence

Add zio-json support for serialization and deserialization

Users can now use the zio-json library to serialize and deserialize data with elastic4s. This change introduces implicit conversions that allow types with zio-json encoders and decoders to be used as Indexable, HitReader, AggReader, and ParamSerializer instances, enabling seamless integration with the zio-json ecosystem.

elastic4s-json-zio · high confidence

Added HTTP client sample application

A new Scala example application (HttpClientExampleApp) has been added to the elastic4s HTTP client Gradle sample. This sample demonstrates how to initialize an ElasticClient, perform a bulk index operation with a wait-for-refresh policy, execute a search query, and handle the response.

samples/elastic4s-http-client-gradle · high confidence

Added JSON body builders for nested and parent-child search queries

The library now includes handlers to serialize \has\_child\, \has\_parent\, \nested\, and \parent\_id\ queries into Elasticsearch JSON. This includes support for \inner\_hits\ configuration in the nested and parent-child queries, allowing users to retrieve nested documents alongside their parents. The \InnerHitQueryBodyBuilder\ also supports standard search options like sorting, highlighting, and source filtering within these inner hits.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/nested · high confidence

Added Maven-based HTTP client sample project

A new sample project using Maven has been added to demonstrate the Elastic4s HTTP client. The included \HttpClientExampleApp\ shows how to initialize a client, perform bulk indexing, and execute a search query against a local Elasticsearch instance.

samples/elastic4s-http-client-maven · high confidence

Added Play JSON support for parameter serialization

The elastic4s-json-play module now includes an implicit ParamSerializer instance for Play JSON, allowing users to serialize case class parameters directly in script requests. This change enables seamless integration of Play's Writes typeclass for script parameters, complementing existing support for indexing and reading documents.

elastic4s-json-play · high confidence

Added ZIO 1.x Task functor instance

The elastic4s-effect-zio-1 module now provides a Cats Functor instance for ZIO's Task type, enabling seamless integration with Cats-based functional programming patterns. This addition allows users to map over ZIO tasks using standard Cats abstractions, with corresponding tests verifying the correct behavior of the mapping operation.

elastic4s-effect-zio-1 · high confidence

Added handlers for Get and Delete snapshot repository operations

The snapshot module now includes request handlers for retrieving (GET) and removing (DELETE) snapshot repositories, in addition to the existing support for creating, deleting, restoring, and querying snapshots. This enables users to manage snapshot repository configurations directly through the library's API.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/snapshot · high confidence

Added handlers for Index Lifecycle Management status, start, and stop operations

This change introduces the HTTP request and response handling logic for three new Index Lifecycle Management (ILM) endpoints: getting the ILM status, starting ILM, and stopping ILM. Users can now interact with these specific ILM control points via the client, with support for optional master\_timeout and timeout parameters on the start and stop actions.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/indexlifecyclemanagement · high confidence

Added handlers for getting and updating index settings

This change introduces the \SettingsHandlers\ trait, which provides the implementation for retrieving and modifying index settings in Elasticsearch. It adds a \GetSettingsHandler\ that constructs GET requests to the \/\_settings\ endpoint and parses the JSON response into a structured \IndexSettingsResponse\, and an \UpdateSettingsHandler\ that sends PUT requests to update index configurations. This enables users to programmatically query and adjust index-level settings via the client.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/settings · high confidence

Added pipeline aggregation support for Elasticsearch

The library now supports Elasticsearch pipeline aggregations, allowing users to perform calculations on the results of other aggregations. This change introduces case classes and builders for specific pipeline aggregations including AvgBucket, BucketScript, BucketSelector, BucketSort, CumulativeCardinality, CumulativeSum, Derivative, Diff, ExtendedStatsBucket, MaxBucket, MinBucket, MovFn, PercentilesBucket, SerialDiff, StatsBucket, and SumBucket. It also adds a GapPolicy enum to handle missing data in bucket paths and a PipelineAgg base trait for the DSL.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/pipeline · high confidence

Added search highlight and raw query handlers

New handler functions have been added to support Elasticsearch search highlighting and raw query execution. The \HighlightBuilderFn\ and \HighlightFieldBuilderFn\ now serialize highlight options into JSON, including support for the \max\_analyzed\_offset\ setting, allowing users to configure detailed text highlighting behavior in search requests. Additionally, \RawQueryBodyFn\ enables the use of raw JSON queries within the search DSL.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches · high confidence

Added support for serializing script parameter objects using Spray JSON

Users can now pass complex objects as parameters to Elasticsearch scripts when using the Spray JSON module. The library provides an implicit \ParamSerializer\ that leverages Spray's \RootJsonWriter\ to convert case classes into JSON strings, allowing script parameters to be serialized automatically without manual formatting.

elastic4s-json-spray · high confidence

Circe module adds ParamSerializer derivation

The elastic4s-json-circe module now provides an implicit ParamSerializer instance for Circe, allowing case classes to be automatically serialized for query parameters when circe.generic.auto is imported. This addition complements the existing automatic derivation for HitReader, AggReader, and Indexable, ensuring consistent codec support across all serialization needs within the library.

elastic4s-json-circe · high confidence

Comprehensive aggregation builder implementations for Elasticsearch

The library now provides complete JSON serialization builders for a wide range of Elasticsearch aggregations, enabling users to construct complex search queries. This update introduces builders for statistical aggregations (Avg, Max, Min, Sum, Stats, ExtendedStats, Cardinality, Percentiles), bucketing aggregations (DateHistogram, Histogram, Range, DateRange, GeoDistance, GeoHashGrid, GeoTileGrid, GeoBounds, GeoCentroid, Nested, ReverseNested, Children, Global, Sampler, Missing, MultiTerms, Composite, Filters, KeyedFilters, Filter, AdjacencyMatrix), and specialized aggregations (ScriptedMetric, SigTerms, SigText, IpRange). Each builder correctly maps Scala configuration objects to the Elasticsearch JSON DSL, supporting features like script fields, sub-aggregations, metadata, and specific options such as hard bounds for histograms or precision for geotile grids.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/builders · high confidence

Comprehensive field mapping handlers for Elasticsearch

The \elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/fields\ module now provides complete serialization and deserialization support for a wide range of Elasticsearch field types. This includes new handlers for specialized fields such as \AggregateMetricField\, \AnnotatedTextField\ (with analyzer support), \DenseVectorField\ (supporting HNSW, Flat, and various quantization types like Int8/Int4 and Bbq), \ExponentialHistogramField\, \IcuCollationKeywordField\, \MatchOnlyTextField\, \PatternTextField\, \RankVectorsField\, \SemanticTextField\, and \SparseVectorField\. The \ElasticFieldBuilderFn\ centralizes dispatching to these handlers, ensuring that complex field configurations—including multi-fields, nested properties, and specific index options—are correctly translated to and from JSON mappings.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/fields · high confidence

Comprehensive rewrite of search aggregation DSL and builders

The aggregation definitions in \elastic4s-core\ have been completely rewritten to use a modern, fluent Scala API. All aggregation types (such as \DateHistogramAggregation\, \HistogramAggregation\, \GeoTileGridAggregation\, and \CompositeAggregation\) are now defined as case classes with dedicated builder methods (e.g., \.field()\, \.script()\, \.subAggregations()\) and support for metadata. A new \AggregationBuilderFn\ centralizes the serialization logic, mapping these case classes to their corresponding JSON builders. This change introduces support for new aggregation features like \AdjacencyMatrixAggregation\, \AutoDateHistogramAggregation\, and \VariableWidthAggregation\, while also standardizing how sub-aggregations and metadata are handled across all aggregation types.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs · high confidence

Expanded search query support with new handlers and routing

This update significantly broadens the range of Elasticsearch queries supported by the elastic4s HTTP client. The central QueryBuilderFn has been updated to route a wide array of new query types, including DistanceFeature, FunctionScore, Intervals, KNN, MoreLikeThis, Pinned, RankFeature, ScriptScore, Semantic, and SparseVector queries, alongside a comprehensive suite of Span queries (Containing, FieldMasking, First, MultiTerm, Near, Not, Or, Term, Within). Additionally, handlers for Percolate, Script, and Noop queries have been added, ensuring that these specific search capabilities can now be constructed and serialized correctly.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries · high confidence

Implementation of Search Template API handlers and builders

This change introduces the core implementation for Elasticsearch search templates within the elastic4s client. It adds new files to construct JSON request bodies for putting, getting, removing, and executing search templates (PutSearchTemplateBuilderFn, TemplateSearchBuilderFn) and defines the HTTP handlers (SearchTemplateHandlers) that map these requests to the appropriate Elasticsearch endpoints (/\_scripts/ and /\_search/template). This enables users to programmatically manage and execute stored search templates.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/template · high confidence

Ingest pipeline API support with versioning and GeoIP processor

The ingest module now supports creating, retrieving, and deleting pipelines via the new \IngestHandlers\. The \GetPipelineResponse\ and \PutPipelineRequest\ include an optional \version\ field, allowing users to manage pipeline versioning. Additionally, a \GeoIPProcessor\ is provided to enrich documents with geographical data, and a \CustomProcessor\ allows for arbitrary processor definitions.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/ingest · high confidence

Initial project scaffolding and configuration

This change introduces the foundational configuration files for the elastic4s project, including \.editorconfig\ for consistent code formatting, \.scalafmt.conf\ to enforce Scala formatting rules, \.scala-steward.conf\ to manage automated dependency updates, and \.git-blame-ignore-revs\ to ignore formatting commits in git history. It also adds a \docker-compose.yml\ file to spin up an Elasticsearch 9.5.4 instance for testing, configures SBT build options in \.sbtopts\, sets the project version to 9.5.1-SNAPSHOT in \version.sbt\, updates \.gitignore\ to exclude IDE and build artifacts, and replaces the minimal \README.md\ with comprehensive documentation covering installation, usage, and compatibility matrices.

(repo-wide) · high confidence

Introduce Akka Reactive Streams integration for Elasticsearch

This change adds the \elastic4s-reactivestreams-akka\ module, providing Akka-based reactive streams components for Elasticsearch. It introduces \BulkIndexingSubscriber\ for batching and bulk-indexing incoming data streams, and \ScrollPublisher\ for streaming search results via scroll cursors. These components are exposed through the \ReactiveElastic\ extension on \ElasticClient\, allowing users to integrate Elasticsearch into Akka Streams pipelines. The implementation relies on \CommonRequestOptions\ for configuration and includes comprehensive integration and whitebox verification tests to ensure compliance with the Reactive Streams specification.

elastic4s-reactivestreams-akka · high confidence

Introduce Pekko-based HTTP client with host blacklisting and retry logic

This change adds a new HTTP client implementation for elastic4s built on Apache Pekko (specifically Pekko HTTP and Streams). It introduces a configurable host blacklist mechanism that automatically excludes failed hosts for an exponentially increasing duration (configurable min/max duration) and supports retrying requests with a delay when all hosts are temporarily blacklisted. The client includes a request queue with backpressure, SSL verification settings, and connection pool configuration, providing a resilient way to communicate with Elasticsearch clusters using the Pekko ecosystem.

elastic4s-client-pekko/src/main · high confidence

Introduce Pekko-based reactive streams for Elasticsearch bulk indexing and scrolling

The \elastic4s-reactivestreams-pekko\ module now provides reactive-streams integration built on Apache Pekko, replacing the previous Akka HTTP streams implementation. Users can now use \ReactiveElastic.subscriber\ to create a \BulkIndexingSubscriber\ that buffers and bulk-indexes documents to Elasticsearch with configurable batch sizes, flush intervals, and retry logic, and \ReactiveElastic.publisher\ to create a \ScrollPublisher\ that streams search results via scroll cursors. Both components require \CommonRequestOptions\ and an \ActorRefFactory\, and are accompanied by integration and TCK verification tests to ensure correct reactive behavior.

elastic4s-reactivestreams-pekko · high confidence

Introduce http4s-based HTTP client implementation

Added a new HTTP client implementation for elastic4s using the http4s library. This includes the Http4sClient class for managing connections and requests, Elastic4sEntityEncoders to handle encoding of various entity types (strings, input streams, files, byte arrays) into http4s entities, and RequestResponseConverters to translate elastic4s requests and responses into the http4s format. This provides an alternative backend for making HTTP requests to Elasticsearch.

elastic4s-client-http4s/src/main, elastic4s-client-sttp4 · high confidence

New Akka Streams source and batch sink for Elasticsearch

The elastic4s-streams-akka module now includes an ElasticSource that publishes documents via Elasticsearch scroll cursors and a BatchElasticSink that accepts sequences of items for bulk indexing. The source manages scroll lifecycle (including clearing the scroll on completion) and fixes premature stream completion when buffered hits remain after an empty prefetched page, while the sink supports configurable immediate refresh after operations and retries failed bulk items.

elastic4s-streams-akka · high confidence

New JavaClient implementation for Elasticsearch HTTP communication

The elastic4s-client-esjava module now includes a new JavaClient implementation that wraps the Elasticsearch Java Rest Client. This change introduces a new way to create ElasticClient instances, supporting both direct RestClient wrapping and configuration via callbacks for request and HTTP client settings. The implementation handles HTTP entity conversion, response parsing with proper charset handling, and resource management using scala.util.Using for input streams.

elastic4s-client-esjava · high confidence

New ZIO HTTP client implementation for Elastic4s

Users can now use ZIO HTTP as the underlying transport for Elastic4s by importing the new \elastic4s-client-zio-http\ module. This change introduces the \ZIOHttpClient\, which implements the standard \HttpClient\[Task\]\ interface using ZIO's \Task\ effect type, allowing applications to interact with Elasticsearch via ZIO's runtime. The implementation handles request construction, body encoding (including UTF-8 and file streams), and response parsing, and is accompanied by integration tests verifying basic operations like indexing, authentication, and UTF-8 support.

elastic4s-client-zio-http · high confidence

New cluster management and node inspection handlers

This change introduces a new set of handlers in the \elastic4s-handlers\ module for interacting with Elasticsearch cluster and node APIs. Users can now retrieve cluster state, health, and statistics, as well as get and update cluster settings (including persistent and transient configurations). Additionally, new capabilities allow inspecting node usage and hot threads, with support for specific parameters like node ID, timeout, and thread sampling options.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/cluster · high confidence

New handlers for geo search queries

Added body-serialization handlers for geo search queries (bounding box, distance, polygon, and shape) in the elastic4s-handlers module, enabling these queries to be correctly converted to Elasticsearch JSON bodies.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/geo · high confidence

New sniffing client implementation with resource management

Added a new \JavaClientSniffed\ module that wraps the Elasticsearch Java REST client with automatic node sniffing capabilities. Users can now configure sniffing intervals and failure-handling delays via \SniffingConfiguration\. The implementation ensures the underlying \Sniffer\ resource is properly closed after use to prevent leaks.

elastic4s-client-sniffed · high confidence

New sttp-based HTTP client implementation

The sttp client module now uses a new \SttpRequestHttpClient\ that leverages sttp 3 for making requests. This implementation supports custom headers, handles various entity types (string, byte array, file, and input stream) with proper resource management via \scala.util.Using\, and provides a convenient \apply\ method with reasonable defaults for implicit execution contexts and backends.

elastic4s-client-sttp/src/main · high confidence

New testkit utilities for integration testing

The elastic4s-testkit module now includes a suite of ScalaTest matchers and helper traits to simplify integration testing. Users can now use index matchers like \haveCount\, \haveDocument\, \containDoc\, \beCreated\, and \beEmpty\, as well as search matchers such as \containId\, \haveFieldValue\, \haveSourceField\, \haveSourceFieldValue\, \haveTotalHits\, \haveHits\, and \haveNoHits\. Additionally, the \ElasticSugar\ trait provides blocking helpers like \blockUntilGreen\, \blockUntilDocumentExists\, and \blockUntilCount\ to handle asynchronous index operations, while \DockerTests\ offers a base trait for managing Docker-based Elasticsearch instances with automatic client shutdown hooks.

elastic4s-testkit · high confidence

New text search query handlers and expanded parameter support

The library now supports the \combined\_fields\ query type and adds the \autoGenerateSynonymsPhraseQuery\ parameter to \MatchQuery\, \MultiMatchQuery\, \QueryStringQuery\, and \SimpleStringQuery\. Additionally, \MatchPhraseQuery\ and \MatchPhrasePrefixQuery\ now support the \zeroTermsQuery\ parameter, and \QueryStringQuery\ exposes \maxDeterminizedStates\ and \quoteAnalyzer\. These changes are implemented via new body-building handlers in the text queries module, enabling more precise control over text search behavior.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/text · high confidence

Support for Elasticsearch Synonyms API

Added handlers for the Elasticsearch Synonyms API, enabling users to manage synonym sets and individual synonym rules. This includes creating or updating synonym sets and rules, retrieving specific sets or rules, listing available sets, and deleting sets or rules via the \/\_synonyms\ endpoint.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/synonyms · high confidence

Support for Stored Script APIs

Users can now manage stored scripts in Elasticsearch. This change introduces handlers for the PUT, GET, and DELETE operations on stored scripts (endpoints like /\_scripts/{id}) and adds a builder function to serialize script requests, including support for source vs. stored script types, parameters, and options.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/script · high confidence

Support for the Terms Enum API

Users can now execute the Elasticsearch Terms Enum API to retrieve unique term values for a specific field. This change adds the handler implementation in \elastic4s-handlers\, which constructs the necessary POST request to the \/\_terms\_enum\ endpoint and serializes request parameters such as field name, string prefix, size, timeout, case-insensitivity, index filters, and search-after values into the JSON body.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/termsenum · high confidence

Task API handlers support parent task filtering and cancellation

The task handler module now implements request builders for the Elasticsearch Tasks API, including support for filtering task lists by a parent task ID via the \parent\_task\_id\ query parameter. It also provides handlers for listing tasks, retrieving specific task details, and cancelling tasks either by ID or by node/action filters, ensuring responses correctly interpret cancellation status even when node failures are present.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/task · high confidence

Architecture

Count request handler moved to dedicated handlers module

The implementation for the Count API request handler has been relocated into the \elastic4s-handlers\ module. This change introduces \CountBodyBuilderFn\ to construct the JSON body and \CountHandlers\ to manage the HTTP request building, including URL encoding for indices and query parameters like \allow\_no\_indices\ and \stats\. This reorganization centralizes handler logic within the new module structure.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/count · high confidence

Migrated index request handlers and content builders to a dedicated module

Index-related request handlers and content builders have been moved into the \elastic4s-handlers\ module under the \handlers.index\ package. This refactoring consolidates the implementation for index operations—including creating indices, managing templates, performing analysis, handling rollovers, and updating index settings—into a single, organized location, separating the handler logic from the core request definitions.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/index · high confidence

Reorganized API into modular traits

The client API has been refactored from a single monolithic trait into a collection of focused, modular traits (such as AggregationApi, QueryApi, and SnapshotApi). This change improves code organization and maintainability, allowing users to mix in only the specific API components they need rather than importing the entire client interface.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/api · high confidence

Security handlers for roles and users moved to elastic4s-handlers

The implementation for Elasticsearch security operations has been reorganized: role and user handlers (including create, update, delete, get, enable, disable, and password change) along with their JSON content builders have been moved into the elastic4s-handlers module. This change consolidates the HTTP request building and response handling logic for these security features in one place, while the request/response data models remain in their respective request modules.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/security · high confidence

Behavioural changes

Akka HTTP client implementation with configurable settings and retry logic

The Akka HTTP client module has been re-implemented to provide a robust, configurable HTTP transport layer for Elasticsearch. This change introduces a new \reference.conf\ configuration file and associated settings classes (\AkkaHttpClientSettings\) that allow users to define connection parameters such as hosts, SSL verification (\verify-ssl-certificate\), queue size, and blacklist durations. The client now includes a \DefaultBlacklist\ mechanism with exponential backoff for failed hosts and a retry strategy that respects a \max-retry-timeout\, ensuring requests are retried with delays even when all hosts are temporarily blacklisted. Additionally, the implementation supports basic authentication via username/password configuration and allows customization of HTTP requests through a \requestCallback\ in the settings.

elastic4s-client-akka/src/main · high confidence

Consolidated delete handlers with task support and slicing

The delete handlers have been consolidated into a single module, introducing support for asynchronous Delete By Query operations via task responses and enabling automatic slicing for parallelized deletions. The Delete By Query handler now parses task IDs from responses to return task references when asynchronous execution is requested, and it supports configuring slice-based parallelism in the request body. Additionally, the handler respects the ignore\_unavailable parameter and shard preference settings, while the Delete By Id handler continues to handle standard document deletion with versioning and routing support.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/delete · high confidence

Elastic4s core restructured with generic effect types and explicit authentication support

The elastic4s-core module has been refactored to support generic effect types (F\[\_\]) via the new ElasticClient, allowing users to integrate with various async libraries through the HttpClient typeclass. This change introduces explicit authentication support via CommonRequestOptions, enabling Basic (UsernamePassword) and ApiKey headers to be set on requests. The API surface is consolidated through the new ElasticApi trait, which aggregates all DSL components, and the response model is updated to use a sealed Response trait with RequestSuccess and RequestFailure cases, providing standard functional composition methods like map, flatMap, and fold for handling results.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s · high confidence

Elastic4s domain model restructured for Scala 3 and Elasticsearch 8

The elastic4s-domain module has been completely rewritten to support Scala 3 and align with Elasticsearch 8.x. This change introduces a new, comprehensive domain model including updated field types (such as DenseVector, Semantic, and Sparse Vector), new analysis components (analyzers, tokenizers, and filters), and improved error handling structures. It also adds core infrastructure classes like Hit, HitReader, and Indexes, replacing the previous domain definitions to provide a more robust and type-safe foundation for Elasticsearch interactions.

elastic4s-domain · high confidence

Enhanced KNN search with inner\_hits and rescore vector support

The KNN search handler now supports additional configuration options for more precise vector search results. Users can now specify inner\_hits to retrieve nested document details within KNN results, and utilize the rescore\_vector parameter with oversampling to improve search accuracy. The builder also continues to support query\_vector\_builder for text embedding models, standard query vectors, filtering, similarity metrics, boosting, and query naming.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/knn · high confidence

Enhanced json4s integration with parameter serialization and ID fallback

The elastic4s-json-json4s module now provides an implicit ParamSerializer for json4s, allowing json4-serializable objects to be used directly in script parameters. Additionally, the Json4sHitReader has been updated to populate the document ID in the deserialized object from hit metadata when the ID is not present in the source JSON, ensuring consistent ID handling during deserialization.

elastic4s-json-json4s · high confidence

Explicit Functor instances for Monix and Scalaz Task types

The \elastic4s-effect-monix\ and \elastic4s-effect-scalaz\ modules now explicitly provide \cats.Functor\ instances for their respective \Task\ types (\monix.eval.Task\ and \scalaz.concurrent.Task\). This ensures that these effect types are properly recognized by the Cats type class hierarchy, allowing for consistent functional programming patterns when using these effect systems with elastic4s.

elastic4s-effect-monix, elastic4s-effect-scalaz · high confidence

Handlers for node info/stats and search collapse moved to handlers module

The implementation code for node information and statistics requests (NodeInfoHandler, NodeStatsHandler) and the search collapse builder (CollapseBuilderFn) has been relocated into the elastic4s-handlers module. This change organizes the codebase by moving these specific handler implementations to a dedicated location, ensuring that the logic for building Elasticsearch API requests for node stats and search collapsing is now contained within the handlers package structure.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/nodes, elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/collapse · high confidence

Handlers for term-based search queries now support case-insensitive matching and expanded type options

The query body handlers in the term query package have been updated to support new Elasticsearch features and type flexibility. Term, prefix, regex, and wildcard queries now support a case-insensitive flag, allowing users to perform case-insensitive matching without modifying their data. Range queries have been extended to accept Int values in addition to Long, Double, String, and ElasticDate, providing more convenient type handling for integer ranges. Additionally, the handlers for these queries correctly serialize boost, query name, and other standard parameters.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/term · high confidence

Handlers module refactored for Scala 3 and Jackson 3

The elastic4s-handlers module has been restructured to support Scala 3 and migrate the JSON serialization library from Jackson 2 to Jackson 3. This includes introducing new core types such as \ElasticRequest\ (which now supports custom headers), \HttpEntity\, and \Handler\ typeclasses, alongside updated \ResponseHandler\ logic using the new Jackson \ObjectMapper\. Existing request handlers (e.g., for Cat APIs, Explain, Term Vectors) have been moved into this module and updated to use the new request/response models and Jackson 3 support.

elastic4s-handlers · high confidence

Implementation of Get and MultiGet request handlers

This change introduces the handler implementations for the Get and MultiGet API endpoints within the elastic4s-handlers module. The new GetHandler constructs requests to specific document endpoints, properly encoding index names and IDs, and handles response parsing for success, missing documents (404), and errors. The MultiGetHandler manages bulk retrieval requests, building the necessary JSON body structure and handling HTTP responses, including specific error cases like 401 Unauthorized. These handlers replace previous logic, ensuring consistent URL encoding and response handling for document retrieval operations.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/get · high confidence

Introduction of generic JSON abstraction and Jackson 3 migration

The library now uses a generic JSON abstraction defined by the new FieldValue trait and its implementations (NullFieldValue, ArrayFieldValue, SimpleFieldValue, NestedFieldValue) along with a FieldValueWriter interface, allowing for more flexible field value handling. Additionally, the underlying JSON serialization has been migrated from Jackson 2 to Jackson 3 (tools.jackson), with the JacksonSupport object providing a configured ObjectMapper that enables features like unquoted property names, single quotes, and acceptance of single values as arrays.

elastic4s-json-builder/src/main/scala/com/sksamuel/elastic4s · high confidence

Migrated index alias and exists request handlers to separate modules

The implementation for index alias operations (adding, removing, and getting aliases) and document existence checks has been moved into dedicated handler modules (\IndexAliasHandlers\ and \ExistsHandlers\). This change introduces new builder and handler classes that construct the specific HTTP requests (POST to \/\_aliases\ for alias actions, HEAD for exists checks) and parse the corresponding responses, effectively decoupling these specific request types from the broader handler structure.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/alias · high confidence

Moved compound query handlers to dedicated module

The handlers for compound search queries (Bool, Boosting, ConstantScore, and DisMax) have been moved into the new \elastic4s-handlers\ module. This refactoring organizes the query serialization logic into specific builder functions within the \handlers/searches/queries/compound\ package, ensuring that the JSON bodies for these queries are generated correctly without unnecessary empty arrays or fields.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/compound · medium confidence

New sort handlers added to the handlers module

The sort query builders (Field, GeoDistance, Nested, Score, and Script) have been moved into the new \elastic4s-handlers\ module. This change reorganizes the codebase structure but does not alter the functionality of search sorting for users.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/sort · high confidence

Refactored bulk request builder to use iterators for improved memory efficiency

The bulk request handling logic has been refactored to reduce memory retention during the construction of HTTP bodies. The \BulkBuilderFn\ now returns an \Iterator\[String\]\ instead of retaining a set, allowing the \BulkHandler\ to stream the NDJSON content more efficiently. This change impacts how bulk operations (index, delete, update) are serialized and sent to Elasticsearch, potentially lowering memory usage for large bulk requests.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/bulk · high confidence

Refactored index mapping handlers and builders

The index mapping request handlers and JSON builders have been reorganized into dedicated components within the mapping package. This includes new functions for building dynamic template bodies, converting index mappers to fields, and constructing mapping definitions, alongside updated handlers for getting and putting mappings. This change improves the structure of how mapping requests are serialized and processed.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/index/mapping · high confidence

Reindex API handler supports advanced request parameters and response fields

The reindex handler now constructs requests with support for conflicts handling (proceed/abort), max\_docs, source slicing (id/max), remote reindexing (host, username, password), version type, create-only mode, and pipeline configuration. The response model has been expanded to include a failures field for capturing bulk index-by-scroll errors, along with throttling metrics (throttled\_millis, requests\_per\_second, throttled\_until\_millis).

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/reindex · high confidence

Search request handling and serialization refactored into dedicated builder and handler components

The search request logic in the core module has been reorganized into specific builder and handler files to improve modularity and support new search capabilities. SearchBodyBuilderFn now constructs the JSON body for search requests, explicitly supporting runtime mappings (including date formats and composite fields), multiple KNN fields, PIT (Point-in-Time) API usage, and custom aggregations. MultiSearchBuilderFn handles the NDJSON formatting for multi-search requests, including header options like preference and request cache. SearchHandlers manages the HTTP request construction for both single and multi-search endpoints, while SearchScrollHandlers and SearchIterator provide robust scroll context management, including automatic clearing of the scroll context upon exhaustion to free server resources. Additionally, deprecated search template APIs are retained but marked for removal in favor of the stored scripts API.

elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches · high confidence

Update by query now supports asynchronous execution, automatic slicing, and failure reporting

The update handler module has been refactored to support asynchronous update-by-query operations, allowing users to initiate long-running updates without blocking. The implementation adds support for automatic slicing to parallelize update tasks, configurable routing, and shard preference. Additionally, the response model now includes a failures field to report bulk index by scroll errors, and the handler correctly processes doc\_as\_upsert and scripted\_upsert flags.

elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/update · high confidence

Test coverage

Added analysis example tests; Added commented-out test scaffolding for Index and Search matchers; Added integration and DSL tests for admin and validation operations; Added integration tests for Elasticsearch alias operations; Added integration tests for KNN search capabilities; Added integration tests for cluster management APIs; Added integration tests for completion, phrase, and term suggestions; Added integration tests for index and cat API requests; Added integration tests for search aggregations; Added integration tests for search query DSL components; Added integration tests for snapshot repository and snapshot lifecycle operations; Added test coverage for analysis token filters; Added test coverage for client configuration, search, and cluster management; Added test coverage for core client, error handling, and request builders; Added test coverage for script-based search sorting; Added test for Jackson double serialization format; Added test for ZIO Task Functor; Added test for authentication header propagation in SttpRequestHttpClient; Added test for reload search analyzers request; Added tests for Cat API endpoints; Added tests for Elastic field mapping serialization and integration; Added tests for ElasticClient authentication and UTF-8 support; Added tests for Get and MultiGet request handling; Added tests for Index Lifecycle Management status and control; Added tests for Jackson-based JSON serialization in Elasticsearch operations; Added tests for Node Hot Threads and Node Usage APIs; Added tests for Pekko HTTP client and blacklist logic; Added tests for Point-in-Time API; Added tests for Reindex API parameters; Added tests for Update and UpdateByQuery requests; Added tests for XContentBuilder serialization of numeric and iterable types; Added tests for bulk request operations; Added tests for delete API functionality; Added tests for index settings retrieval and updates; Added tests for mapping DSL and API definitions; Added tests for search DSL, inner hits, multi-search, and scrolling; Added tests for search field collapsing via HTTP client; Added tests for search highlight functionality; Added tests for security roles and users APIs; Added tests for stored script and script field functionality; Added tests for the Terms Enum API; Added tests for the http4s client integration; Added tests for the server info request; Added tests for the synonyms API; Added unit and integration tests for the Akka HTTP client; Added unit tests for analyzer and token filter builders; Added unit tests for analyzer and tokenizer builders.

Dependencies

Build infrastructure overhaul and dependency updates

The project build has been significantly restructured, migrating to SBT 1.x with a new multi-module layout supporting Scala 2.13.18 and Scala 3.3.8, while dropping Scala 2.11 and 2.12 support. Key dependency updates include upgrading the Elasticsearch REST client to version 7.12.1, Jackson to 2.10.4, and Log4j to 2.26.1. The build also introduces Pekko support (renaming Akka HTTP streams modules), adds new client modules for ZIO HTTP and sttp4, and configures publishing via the Central Portal. Sample projects for Maven, Gradle, and SBT have been added to demonstrate integration.

(dependencies) · high confidence

Build infrastructure overhaul with SBT 2.0 and centralized dependency management

The project's build system has been significantly restructured: SBT has been upgraded to version 2.0.9, and build configuration is now centralized in a new \project/Dependencies.scala\ file that defines versions for all libraries (including Elasticsearch 9.5.4, Jackson 3.2.3, and ZIO 2.1.26). The build also introduces specific JVM memory settings via \.sbtopts\ and updates release and formatting plugins (\sbt-ci-release\ 1.12.1, \sbt-scalafmt\ 2.6.2).

project · high confidence

Jackson integration upgraded to Jackson 3

The Jackson JSON module has been migrated from Jackson 2 to Jackson 3, updating the underlying library imports (e.g., from com.fasterxml.jackson to tools.jackson) and reconfiguring the ObjectMapper with the same serialization and deserialization settings (such as handling of Scala types, null values, and single-value arrays). This change ensures compatibility with the newer Jackson version while maintaining existing JSON handling behavior for users of the elastic4s-json-jackson module.

elastic4s-json-jackson/src/main · high confidence

Migrate JSON builder to Jackson 3

The JSON builder implementation in elastic4s-json-builder has been updated to use Jackson 3 (tools.jackson.databind) instead of the previous Jackson 2 version. This change affects how JSON nodes are created and serialized internally, ensuring compatibility with the newer Jackson library version while maintaining the same public API for building JSON content.

elastic4s-json-builder/src/main/scala/com/sksamuel/elastic4s/json · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 35 → 54 (+18.9)
  • Rubric changed (rubric-2026.08.15 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 94 (-6.2)
  • Architecture 69 → 94 (+25.1)
  • Maturity 51 → 39 (-11.9)
  • Readiness 20 → 46 (+26.1)
  • Security 31 → 81 (+49.5)

Resolved (26)

  • Coverage not measured — test suite did not build
  • Dimension evaluation failed
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 6 more

New (145)

  • AkkaHttpClient.queueRequestWithRetry (cognitive 22) (elastic4s-client-akka/src/main/scala/com/sksamuel/elastic4s/akka/AkkaHttpClient.scala)
  • Boundary-crossing change coupling: SearchScrollHandlers.scala ↔ IndexAdminHandlers.scala (elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchScrollHandlers.scala)
  • Boundary-crossing change coupling: SearchScrollHandlers.scala ↔ UpdateHandlers.scala (elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchScrollHandlers.scala)
  • Change coupling: SearchHandlers.scala ↔ SearchScrollHandlers.scala (elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/SearchHandlers.scala)
  • Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
  • Duplicated block (10 lines × 2) (elastic4s-client-akka/src/main/scala/com/sksamuel/elastic4s/akka/AkkaHttpClient.scala)
  • Duplicated block (10 lines × 2) (elastic4s-client-sttp/src/main/scala/com/sksamuel/elastic4s/sttp/SttpRequestHttpClient.scala)
  • Duplicated block (10 lines × 2) (elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/fields/BooleanFieldBuilderFn.scala)
  • Duplicated block (10 lines × 2) (elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/fields/NestedFieldBuilderFn.scala)
  • Duplicated block (10 lines × 2) (elastic4s-reactivestreams-akka/src/main/scala/com/sksamuel/elastic4s/akka/reactivestreams/ScrollPublisher.scala)
  • Duplicated block (10 lines × 3) (elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/builders/AvgAggregationBuilder.scala)
  • Duplicated block (11 lines × 2) (elastic4s-client-akka/src/main/scala/com/sksamuel/elastic4s/akka/DefaultHttpPoolFactory.scala)
  • Duplicated block (11 lines × 2) (elastic4s-reactivestreams-akka/src/main/scala/com/sksamuel/elastic4s/akka/reactivestreams/BulkIndexingSubscriber.scala)
  • Duplicated block (11 lines × 3) (elastic4s-domain/src/main/scala/com/sksamuel/elastic4s/requests/get/GetResponse.scala)
  • Duplicated block (12 lines × 2) (elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/span/SpanContainingQueryBodyFn.scala)
  • Duplicated block (12 lines × 2) (elastic4s-json-zio-1/src/main/scala/com/sksamuel/elastic4s/ziojson/package.scala)
  • Duplicated block (12 lines × 3) (elastic4s-handlers/src/main/scala/com/sksamuel/elastic4s/handlers/searches/queries/GaussianDecayScoreBuilderFn.scala)
  • Duplicated block (13 lines × 2) (elastic4s-client-akka/src/main/scala/com/sksamuel/elastic4s/akka/AkkaHttpClient.scala)
  • Duplicated block (13 lines × 2) (elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/builders/GeoHashGridAggregationBuilder.scala)
  • Duplicated block (13 lines × 2) (elastic4s-streams-akka/src/main/scala/com/sksamuel/elastic4s/akka/streams/ElasticSource.scala)
  • …and 125 more

Changes since last survey

  • 48 commits — 45 feature/other, 3 fixes

By area

  • project/Dependencies.scala — 15 commits
  • (root) — 10 commits
  • elastic4s-client-akka/src — 4 commits
  • elastic4s-core/src — 4 commits
  • project/build.properties — 4 commits
  • elastic4s-domain/src — 2 commits
  • elastic4s-handlers/src — 2 commits
  • elastic4s-client-esjava/src — 1 commit
  • elastic4s-client-http4s/src — 1 commit
  • elastic4s-client-sttp4/src — 1 commit
  • elastic4s-json-json4s/src — 1 commit
  • elastic4s-streams-akka/src — 1 commit
  • elastic4s-testkit/src — 1 commit
  • project/plugins.sbt — 1 commit

Notable commits

  • fix: Fix hang when queue admission fails before host is assigned (#4063)
  • fix: Fix premature completion in ElasticSource (#4064)
  • fix: Fix size- and list-methods in DefaultBlackList (#4065)
  • change: Add new synonyms-related fields (#4116)
  • change: Add shutdown hook to DockerTests (#4112)
  • change: Add stats-field to CountRequest (#4071)
  • change: Clear Elasticsearch scroll context after exhaustion (#4113)
  • change: Close Sniffer in JavaClientSniffed after use (#4114)
  • change: Complete SourceQueue after use (#4115)
  • change: Convert expressions to Single Abstract Methods (#4117)
  • change: Emit the script field in ExtendedStatsAggregationBuilder (#4100)
  • change: Enable elastic4s-client-akka for scala 3 (#4109)
  • change: Populate id in Json4sHitReader from hit metadata (#4061)
  • change: Release ember client after tests (#4111)
  • change: Release version 9.5.0
  • change: Replace deprecated url with uri (#4119)
  • change: Retry with delay if all hosts are blacklisted (#4066)
  • change: Set version to next snapshot
  • change: Support script_fields in TopHitsAggregation (#4067)
  • change: Update IcuCollationKeywordField (#4062)
  • …and 28 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

Philippus/elastic4s was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 27 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit b3c0502292f577a1c8f54e7baf140888962852ec — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-d00c643c3f66.