Skip to content
プロジェクト

概要

An Elixir flavored HTTP client and DSL library for Elasticsearch

開発ツール

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

Build Status HEX version HEX downloads Deps Status

An Elixir flavored HTTP client and DSL library for building JSON based settings, mappings, queries 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

関連プロジェクトを探す

読み込み中…