EOS: Elasticsearch Module
Table of Contents
(provide 'eos-es)
Elasticsearch
(use-package es-mode :ensure t :init (add-to-list 'auto-mode-alist '("\\.es$" . es-mode)) (add-hook 'es-mode-hook 'auto-indent-mode) (add-hook 'es-result-mode-hook 'hs-minor-mode) :config (setq es-warn-on-delete-query nil es-always-pretty-print t))
Some setup for the Java-specific ES project, with EDE
;; Enable EDE globally (global-ede-mode 1) (when (fboundp 'ede-java-root-project) (ede-java-root-project "elasticsearch" :file "/home/hinmanm/es/elasticsearch/build.gradle" :srcroot '("core/src")))
Logstash
There's a nice mode for logstash configurations that seems to work pretty well, so I install that
(use-package logstash-conf :ensure t)
ES Services started and Run from Emacs (prodigy)
I basically use this to start up ES when I need to test something really quickly
I have been trying out esvm for this lately also, check out my ESVM configuration elsewhere in my dotfiles
So I configure prodigy like so:
(use-package prodigy :ensure t :defer t :config (setq prodigy-services '()) (prodigy-define-service :name "Kibana 5.0.1" :cwd "~/ies/kibana-5.0.1-linux-x64_86" :command "~/ies/kibana-5.0.1-linux-x64_64/bin/kibana" :tags '(work kibana) :port 5601) (prodigy-define-service :name "Elasticsearch 1.7.6" :cwd "~/ies/elasticsearch-1.7.6" :command "~/ies/elasticsearch-1.7.6/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 2.3.5" :cwd "~/ies/elasticsearch-2.3.5" :command "~/ies/elasticsearch-2.3.5/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 2.4.5" :cwd "~/ies/elasticsearch-2.4.5" :command "~/ies/elasticsearch-2.4.5/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 5.0.1" :cwd "~/ies/elasticsearch-5.0.1" :command "~/ies/elasticsearch-5.0.1/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 5.1.2" :cwd "~/ies/elasticsearch-5.1.2" :command "~/ies/elasticsearch-5.1.2/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 5.2.2" :cwd "~/ies/elasticsearch-5.2.2" :command "~/ies/elasticsearch-5.2.2/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 5.3.3" :cwd "~/ies/elasticsearch-5.3.3" :command "~/ies/elasticsearch-5.3.3/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 5.4.1" :cwd "~/ies/elasticsearch-5.4.1" :command "~/ies/elasticsearch-5.4.1/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "Elasticsearch 5.5.0" :cwd "~/ies/elasticsearch-5.5.0" :command "~/ies/elasticsearch-5.5.0/bin/elasticsearch" :tags '(work test es) :port 9200) (prodigy-define-service :name "ES gradle run" :cwd "~/es/elasticsearch" :command "gradle" :args '("run") :tags '(work es) :port 9200))
ESVM configuration
I've been using esvm for managing starting up multiple ES nodes when I need to
test something using the rest API. Here's my configuration for it that tangles
and installs into ~/.esvmrc
Here is the branch with the latest release I use:
5.x
{ "clusters": { "<<es-branch>>": { "branch": "<<es-branch>>", "nodes": 1 }, "2node": { "branch": "<<es-branch>>", "nodes": 2 }, "3node": { "branch": "<<es-branch>>", "nodes": 3 }, "master": { "branch": "master", "nodes": 1 } }, "defaults": { "config": { "cluster.name": "es-lee", "node.add_id_to_custom_path": false, "path.repo": "/tmp", "path.shared_data": "/tmp", "script.indexed": "on", "script.inline": "on" }, "plugins": [] } }
And to install it:
ln -sfv $PWD/out/esvmrc ~/.esvmrc
And, unfortunately, esvm needs node, so I have been using nvm for that
(when (file-exists-p "~/.nvm") (use-package nvm :ensure t :commands (nvm-use nvm-use-for) :init (nvm-use "v6.4.0")))