Elastic is a minimal Erlang API to Elasticsearch packaged to link directly to the official elasticsearch docker image.
Elastic uses erlang.mk. To build run:
make
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.
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 |