engineeringdept

engineeringdept

Snap - an Elasticsearch client for Elixir

I’ve just released the first version of Snap, an Elasticsearch client. It borrows ideas about application structure and process management from Ecto, as well as a DSL-free nature and zero-downtime index management from Elasticsearch.

It adds support for using Streams to perform bulk operations against an index, as well as emitting Telemetry events.

It’s new and probably not production ready yet. I expect to introduce it into a production environment in the coming weeks, and expect some changes will follow.

Please feel free to kick the tyres on it, and see if it’s useful for you. Feedback welcome!

Most Liked

engineeringdept

engineeringdept

Hi there - the library is in production use and has been actively developed since my posting. I believe other people are also using it now.

engineeringdept

engineeringdept

0.6.0 is out which supports the ability to swap HTTP clients, allowing mock HTTP clients for testing, or to use your preferred HTTP client for whatever reason. It still defaults to using Finch.

Full changelog here: snap/CHANGELOG.md at master · breakroom/snap · GitHub

engineeringdept

engineeringdept

I’ve just released Snap 0.9.0, which adds support for the Document API in Snap.Document, exposes a Snap.Search.count function for counting documents in an index, and some quality of life and testing improvements with an index namespacing feature.

The index namespacing feature allows a Snap.Cluster to be isolated on a per-application or per-environment basis so you can have your dev environment indexes be prefixed with dev- and your test environment be prefixed with test- etc.

It also allows us to isolate indexes on a per-process basis, which enables asynchronous tests to be isolated from each other, so they operate on their own view of the cluster’s indexes. This is similar to how Ecto sandboxing works, but within the constraints of ElasticSearch/OpenSearch which doesn’t support transactions.

This makes it possible to set async: true in your tests which is often a nice performance improvement.

I’m really open to feedback on this API - let me know if it does what you expect, in the way you expect it!

For more details see Snap.Cluster.Namespace and Snap.Test.

engineeringdept

engineeringdept

I’ve just released 0.5.0 which includes a bunch of improvements since my last post from other users of the library - see the CHANGELOG. Thanks to everyone who has contributed!

bdarla

bdarla

I managed to find out how to draft such queries. In case someone might also needs to make such queries, I provide an example below, that can be provided to Snap:

query = %{
      query: %{
        span_near: %{
          clauses: [
            %{
              span_multi: %{
                match: %{
                  wildcard: %{
                    "doc.values.description": %{
                      value: "comput*"
                    }
                  }
                }
              }
            },
            %{
              span_multi: %{
                match: %{
                  wildcard: %{
                    "doc.values.description": %{
                      value: "inform*"
                    }
                  }
                }
              }
            }
          ],
          slop: 14,
          in_order: false
        }
      }
    }

Where Next?

Popular in Libraries Top

marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps...
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
mbuhot
Leverage Open Api 3.0 (Swagger) to document, test, validate and explore your Plug and Phoenix APIs. Generate and serve a JSON Open API ...
New
mcrumm
If you would like to migrate away from node/npm/webpack while still using sass, the dart_sass package provides a installer and runner for...
New
michalmuskala
Hello everybody. I have just released Jason - a new JSON library. You might be wondering, why do we need a new library? The primary foc...
New
wfgilman
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: https://github.com/tmbb/phoenix_ws Phoenix channels are a great...
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
New
mtrudel
Bandit is an HTTP server for Plug and WebSock apps. Bandit is written entirely in Elixir and is built atop Thousand Island. It can serve...
New

Other popular topics Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

Sub Categories:

We're in Beta

About us Mission Statement