Giter VIP home page Giter VIP logo

tirexs's Introduction

Build Status HEX version HEX downloads Deps Status

An Elixir flavored HTTP client and DSL library for building JSON based settings, mappings, queries and percolators to Elasticsearch engine.

Getting Started

  1. Add this to the defp deps do list in your mix.exs file:
{:tirexs, "~> 0.8"}
  1. Also in mix.exs, add :tirexs to the :applications list in def application.

  2. In config/dev.exs, configure tirexs:

    # The default uri is http://127.0.0.1:9200
    config :tirexs, :uri, "http://127.0.0.1:9200"

    See lib/tirexs/env.ex for more configuration options.

  3. Index a document:

import Tirexs.HTTP

put("/my_index/users/1", [name: "Jane", email: "[email protected]"])
# {:ok, 201,
#  %{_id: "1", _index: "my_index", _type: "users", _version: 1, created: true}}
  1. Fetch the document:
get("/my_index/users/1")
#  {:ok, 200,
#   %{_id: "1", _index: "my_index",
#     _source: %{email: "[email protected]", name: "Jane"}, _type: "users",
#     _version: 1, found: true}}
  1. Simplified search:
get("/my_index/users/_search?q=name:jane")
#  {:ok, 200,
#   %{_shards: %{failed: 0, successful: 5, total: 5},
#     hits: %{hits: [%{_id: "1", _index: "my_index", _score: 0.30685282,
#          _source: %{email: "[email protected]", name: "Jane"}, _type: "users"}],
#       max_score: 0.30685282, total: 1}, timed_out: false, took: 10}}
  1. Query DSL
import Tirexs.Search

query = search [index: "my_index"] do
  query do
    match "name", "jane"
  end
end
# [search: [query: [match: [name: [query: "jane"]]]], index: "my_index"]

Tirexs.Query.create_resource(query)
#  {:ok, 200,
#   %{_shards: %{failed: 0, successful: 5, total: 5},
#     hits: %{hits: [%{_id: "1", _index: "my_index", _score: 0.30685282,
#          _source: %{email: "[email protected]", name: "Jane"}, _type: "users"}],
#       max_score: 0.30685282, total: 1}, timed_out: false, took: 5}}

Check out /examples directory as a quick intro.

Gitter

tirexs is split into several layers

Find out more in api reference

Not sure?

Look around using https://hex.pm/packages?search=elasticsearch... to find out some other packages.

Contributing

If you feel like porting or fixing something, please drop a pull request or issue tracker at GitHub! Check out the CONTRIBUTING.md for more details.

License

Tirexs source code is released under Apache 2 License. Check LICENSE and NOTICE files for more details. The project HEAD is https://github.com/zatvobor/tirexs.

Analytics

tirexs's People

Contributors

zatvobor avatar opakalex avatar kpanic avatar pavloo avatar markschultz avatar highbeats avatar behe avatar nessamurmur avatar geoff-lee-lendesk avatar ikeikeikeike avatar alpacino avatar loganhenson avatar kenta-aktsk avatar lorenzo avatar douglasroeder avatar aaronjensen avatar ashleyw avatar aphistic avatar lowks avatar maximervy avatar rrrene avatar rschmukler avatar ssboisen avatar chugunov avatar nazarsh avatar matrinox avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.