bloodhound: Elasticsearch client library for Haskell

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Elasticsearch made awesome for Haskell hackers

[Skip to Readme]


Change log
Dependencies aeson (>=0.11.1), base (>=4.14 && <5), blaze-builder, bytestring (>=0.10.0), containers (>=, exceptions, hashable, http-client (>=0.4.30), http-types (>=0.8), mtl (>=1.0), network-uri (>=2.6), scientific (>=, semigroups (>=0.15), semver, text (>=0.11), time (>=1.4), transformers (>=0.2), unordered-containers, vector (>=0.10.9) [details]
License BSD-3-Clause
Copyright 2018 Chris Allen
Author Chris Allen
Category Database, Search
Home page
Bug tracker
Source repo head: git clone
Uploaded by gdifolco at 2022-03-28T17:49:09Z


[Index] [Quick Jump]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for bloodhound-

[back to package description]

Bloodhound TravisCI Hackage

Bloodhound (dog)

Elasticsearch client and query DSL for Haskell


Search doesn't have to be hard. Let the dog do it.


"Bloodhound makes Elasticsearch almost tolerable!" - Almost-gruntled user

"ES is a nightmare but Bloodhound at least makes it tolerable." - Same user, later opinion.

Version compatibility

As of version, Bloodhound has 2 separate module trees for Elasticsearch versions 1 and 5. Import the module that is appropriate for your use case. If you would like to add support for another major version, open a ticket expressing your intend and follow the pattern used for other versions. We weighed the idea of sharing code between versions but it just got too messy, especially considering the instability of the Elasticsearch API. We switched to a model which would allow the persons responsible for a particular protocol version to maintain that version while avoiding conflict with other versions.

See our TravisCI for a listing of Elasticsearch version we test against.


Bloodhound is stable for production use. I will strive to avoid breaking API compatibility from here on forward, but dramatic features like a type-safe, fully integrated mapping API may require breaking things in the future.


The TravisCI tests are run using Stack. You should use Stack instead of cabal to build and test Bloodhound to avoid compatibility problems. You will also need to have an Elasticsearch instance running at localhost:9200 in order to execute some of the tests. See the "Version compatibility" section above for a list of Elasticsearch versions that are officially validated against in TravisCI.

Steps to run the tests locally:

  1. Dig through the [past releases] ( section of the Elasticsearch download page and install the desired Elasticsearch versions.
  2. Install [Stack] (
  3. In your local Bloodhound directory, run stack setup && stack build
  4. Start the desired version of Elasticsearch at localhost:9200, which should be the default.
  5. Run stack test in your local Bloodhound directory.
  6. The unit tests will pass if you re-execute stack test. If you want to start with a clean slate, stop your Elasticsearch instance, delete the data/ folder in the Elasticsearch installation, restart Elasticsearch, and re-run stack test.

Hackage page and Haddock documentation

Elasticsearch Tutorial

It's not using Bloodhound, but if you need an introduction to or overview of Elasticsearch and how to use it, you can use this screencast.


See the examples directory for example code.


Possible future functionality

Span Queries

Beginning here:

Function Score Query

Node discovery and failover

Might require TCP support.

Support for TCP access to Elasticsearch

Pretend to be a transport client?

Bulk cluster-join merge

Might require making a lucene index on disk with the appropriate format.



Geohash cell filter

HasChild Filter

HasParent Filter

Indices Filter

Query Filter

Script based sorting

Collapsing redundantly nested and/or structures

The Seminearring instance, if deeply nested can possibly produce nested structure that is redundant. Depending on how this affects ES performance, reducing this structure might be valuable.

Runtime checking for cycles in data structures

check for n > 1 occurrences in DFS:

Photo Origin

Photo from HA! Designs: