Skip to content

A minimal Erlang API to Elasticsearch which can be easily linked via Docker

License

Notifications You must be signed in to change notification settings

shortishly/elastic

Repository files navigation

Elastic

Elastic is a minimal Erlang API to Elasticsearch packaged to link directly to the official elasticsearch docker image.

Building

Elastic uses erlang.mk. To build run:

make

Build Status

Quick start

docker-compose start
./start-dev.sh

To index a document:

elastic:index_document(hourly, "stats", #{timestamp => erlang:universaltime()}).
{ok,#{<<"_id">> => <<"AU1cyBfR_TWT0pl8At7u">>,
      <<"_index">> => <<"logstash-2015.05.16.12">>,
      <<"_type">> => <<"stats">>,
      <<"_version">> => 1,
      <<"created">> => true}}

In Kibana, create a new index by selecting: "settings", followed by "add new" index pattern. Ensure that both "index contains time-based events" and also "use event times to create index names", with "daily" as the index pattern interval. The "time-field name" should populate with "timestamp" (otherwise a quick "refresh fields" should sort it).

Once the index is created, you can navigate to "Discover" and view the indexed data in Kibana.

Environment

To support linking via Docker the following environment variables are used by default to connect the elasticsearch instance.

Parameter Description Default
ELASTICSEARCH_PORT_9200_TCP_ADDR hostname $(bootdocker ip)
ELASTICSEARCH_PORT_9200_TCP_PORT port 9200

About

A minimal Erlang API to Elasticsearch which can be easily linked via Docker

Resources

License

Stars

Watchers

Forks

Packages

No packages published