soegen

Elasticsearch client for Crystal similar to the stretcher gem for ruby elasticsearch-client
0.9.0 released
Ragmaanir/soegen
20 5
Ragmaanir

soegen Build StatusDependency Status

ElasticSearch client for crystal based on the Stretcher gem for ruby.

Compatibility

Tests pass with crystal 0.20.0 and ES 5.0.1.

Installation

Add this to your application's shard.yml:

dependencies:
  soegen:
    github: ragmaanir/soegen

Usage

require "soegen"

server = Soegen::Server.new # defaults to localhost:9200
idx = server.index("test")

assert !idx.exists?

idx.create

assert idx.exists?

t = idx.type("events")

t.post({data: "1337"})

idx.refresh

results = t.search({query: {match: {data: "1337"}}})

assert results.total_count == 1
assert results.hits.first["data"] == "1337"

For more documentation you can also look at the tests, they are pretty easy to understand. E.g.:

test "callback" do
    i = 0
    server.request_callback do |req|
      i = i + 1
    end

    server.up?
    server.index(INDEX_NAME).create

    assert i == 2
end

The request callback is invoked on every request with response and timing. So you can use that for instrumentation purposes.

TODO

  • [x] Indexes and IndexTypes: CRUD
  • [x] Index documents
  • [x] Index documents in bulk
  • [x] Search for documents and return hit array
  • [x] Log requests (as curl commands)
  • [x] General callback for each request (for e.g. instrumentation)
  • [ ] Analyzer API
  • [ ] Alias API
  • [ ] Tests for child documents

Missing a feature? Found a bug? Need more documentation?

Please open an issue on this project.

Contributing

  1. Fork it ( https://github.com/ragmaanir/soegen/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

soegen:
  github: Ragmaanir/soegen
  version: ~> 0.9.0
License MIT
Crystal none

Authors

Dependencies 0

Development Dependencies 1

  • microtest master
    {'branch' => 'master', 'github' => 'ragmaanir/microtest'}

Dependents 0

Last synced .
search fire star recently