{"id":32168626,"url":"https://github.com/lcostantini/elistix","last_synced_at":"2025-10-21T15:58:01.699Z","repository":{"id":57494161,"uuid":"74484738","full_name":"lcostantini/elistix","owner":"lcostantini","description":"Use Elasticsearch along with your Elixir app without learn any new DSL.","archived":false,"fork":false,"pushed_at":"2017-06-14T14:02:48.000Z","size":35,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-21T15:57:34.088Z","etag":null,"topics":["dsl","elasticsearch","elixir","elixir-lang","phoenix","phoenix-framework"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lcostantini.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-22T15:13:43.000Z","updated_at":"2023-09-06T17:39:38.000Z","dependencies_parsed_at":"2022-09-06T07:30:19.838Z","dependency_job_id":null,"html_url":"https://github.com/lcostantini/elistix","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lcostantini/elistix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcostantini%2Felistix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcostantini%2Felistix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcostantini%2Felistix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcostantini%2Felistix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lcostantini","download_url":"https://codeload.github.com/lcostantini/elistix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lcostantini%2Felistix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280290188,"owners_count":26305279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsl","elasticsearch","elixir","elixir-lang","phoenix","phoenix-framework"],"created_at":"2025-10-21T15:57:57.792Z","updated_at":"2025-10-21T15:58:01.693Z","avatar_url":"https://github.com/lcostantini.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Elistix [![Build Status](https://travis-ci.org/lcostantini/elistix.svg?branch=master)](https://travis-ci.org/lcostantini/elistix) [![Inline docs](http://inch-ci.org/github/lcostantini/elistix.svg)](http://inch-ci.org/github/lcostantini/elistix) [![Hex.pm](https://img.shields.io/hexpm/v/elistix.svg?style=plastic)](https://hex.pm/packages/elistix)\nAn API to talk with ElasticSearch without having to learn a new DSL.\n\nYou are only required to learn ElasticSearch from its own documentation and then\nyou'll be good to go with Elistix.\n\n### Why? ~~personal opinion~~\nHaving to learn a whole new DSL for an already known and very well documented\nservice such as ElasticSearch doesn't sound like fun, nor wise.\n#### Any actual reason behind this?\nWell, let's say you learn an entire new DSL and become a wizard when it comes to\nmaking use of it, then you jump into a project that relies a different one...\nand you're pretty much screwed.\n\nBesides, and perhaps even worse, you may be struggling with a query and then you\nrealize that the problem was actually the library. It could be because they\ndon't support that specific feature or library owners have just decided to\nimplement it in a different way from what official documentation says.\n\nFinally, what happens if ElasticSearch version changes? Well, you don't know if\nthe library will work or support the new version... therefore, you'll be limited\njust to supported versions.\n\n*This library is intended to give you total freedom to try/use every aspect of\nElasticSearch by simply copying and pasting the code provided by the\ndocumentation.*\n\n## Installation\n\n  1. Add `elistix` to your list of dependencies in `mix.exs`:\n\n    ```elixir\n    def deps do\n      [{:elistix, \"~\u003e 1.0.1\"}]\n    end\n    ```\n\n  2. Ensure `elistix` is started before your application:\n\n    ```elixir\n    def application do\n      [applications: [:elistix]]\n    end\n    ```\n\n## Configure environment variables\nThe endpoint for Elasticsearch used by default is\n```\n\"http://127.0.0.1:9200\"\n```\n\nTo change it you have two choices:\n  1. You can create a `.env` file and add:\n\n    ```\n    export ES_URI=\"URI VALUE\"\n    ```\n\n    Then, simply run `source .env` in your shell.\n\n  2. In your Phoenix repository you can set the value in the file `config/{some_env}`\n    e.g.: in `config/dev.exs`\n\n    ```\n    config :elistix, :es_uri, \"URI VALUE\"\n    ```\n\n# How does it work?\nIt just makes use of [HTTPoison](https://github.com/edgurgel/httpoison) to make\nrequests to the ElasticSearch service and Poison to deal with JSON.\n\nBefore start using Elistix you need to require it\n```\nrequire Elistix\n```\n\nNow you can create a new index and load data at the same time with the following\ncommand:\n```\nElistix.Index.load_data(\"examples\", \"example\", '{\"name\": \"trying elistix\", \"status\": \"good\"}')\n```\n\nThen you can run a query over the index\n```\nquery = '{\n          \"query\": {\n            \"term\": {\n              \"status\": {\n                \"value\": \"good\"\n              }\n            }\n          }\n        }'\n\nElistix.Query.search(\"examples\", \"example\", query)\n```\n\nThe response has the format provided by HTTPoison:\n```\n{ok, response} if everything goes well\n{error, reason} if something fail\n```\n\nEven you can build the queries with params given by the endpoint\n```\nquery = '{\n          \"query\": {\n            \"term\": {\n              \"status\": {\n                \"value\": \"#{params[\"status\"]}\"\n              }\n            }\n          }\n        }'\n\nElistix.Query.search(\"examples\", \"example\", query)\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcostantini%2Felistix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flcostantini%2Felistix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flcostantini%2Felistix/lists"}