https://github.com/nikos/elastic-ring
Sample RESTful web application with Clojure ring, persisting and querying data with elasticsearch in the backend
https://github.com/nikos/elastic-ring
Last synced: 3 months ago
JSON representation
Sample RESTful web application with Clojure ring, persisting and querying data with elasticsearch in the backend
- Host: GitHub
- URL: https://github.com/nikos/elastic-ring
- Owner: nikos
- License: mit
- Created: 2015-09-16T19:34:59.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-17T10:53:21.000Z (over 9 years ago)
- Last Synced: 2025-01-13T06:22:21.223Z (4 months ago)
- Language: Clojure
- Size: 164 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elastic-ring
An example application on how to integrate elasticsearch with a clojure REST back-end
allowing to store and query for sample data.## Preparation
Install elasticsearch (for example via homebrew with `brew install elasticsearch`).
The install plugins to adminster elasticsearch via a comfortable admin UI, from
your `ES_HOME` (i.e. `/usr/local/Cellar/elasticsearch/1.7.1`) directory:bin/plugin --install mobz/elasticsearch-head
Then you can navigate your web browser to:
http://localhost:9200/_plugin/head/Elasticsearch HQ (Monitoring and Management Web Application for ElasticSearch instances and clusters)
bin/plugin --install royrusso/elasticsearch-HQ
http://localhost:9200/_plugin/HQ/Bigdesk (Live charts and statistics for elasticsearch cluster):
bin/plugin --install lukas-vlcek/bigdesk
Kopf (web admin interface for elasticsearch):
bin/plugin --install lmenezes/elasticsearch-kopf -> /_plugin/kopf
For easier HTTP interaction, we are going to use httpie (see http://httpie.org),
a user-friendly alternative to curl.## Usage
To start the web application:
lein ring server-headless
See all import initial data:
http localhost:3000/events
Search in a boundary box:
http -v localhost:3000/events/by-location top_right_lat==49.9 top_right_lon==51.1 bottom_left_lat==9.7 bottom_left_lon==10.1
Delete one event:
http -a admin:secret DELETE localhost:3000/events/
## REPL session
lein repl
(use 'elastic-ring.models.events)## Elasticsearch tipps
Local Elasticsearch log file (homebrew compliant):
tail -f /usr/local/var/log/elasticsearch/elasticsearch_niko.log
## Elasticsearch resources
Date Formats:
https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-date-format.htmlQuery syntax:
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.htmlElastisch example:
https://github.com/codemomentum/es-plygrnd/blob/master/src/es_plygrnd/core.clj#L24## License
Copyright © 2015 Niko Schmuck
Distributed under the MIT Open-Source License.