ElasticSearch client for crystal based on the Stretcher gem for ruby.
Tests pass with crystal 0.19.3 and ES 2.4.
Add this to your application's shard.yml
:
dependencies:
soegen:
github: ragmaanir/soegen
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.
- Indexes and IndexTypes: CRUD
- Index documents
- Index documents in bulk
- Search for documents and return hit array
- Log requests (as curl commands)
- General callback for each request (for e.g. instrumentation)
- Analyzer API
- Alias API
- Tests for child documents
Please open an issue on this project.
- Fork it ( https://github.com/ragmaanir/soegen/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- Ragmaanir - creator, maintainer