##JDKインストール
$ brew cask install homebrew/cask-versions/java8
##elasticsearchインストール
$ brew update
$ brew install elasticsearch
$ brew info elasticsearch
elasticsearch: stable 6.2.4, HEAD
Distributed search & analytics engine
https://www.elastic.co/products/elasticsearch
/usr/local/Cellar/elasticsearch/6.2.4 (112 files, 30.8MB) *
Built from source on 2018-08-11 at 01:40:17
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/elasticsearch.rb
==> Requirements
Required: java = 1.8 ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
Data: /usr/local/var/lib/elasticsearch/elasticsearch_hitoshimurakami/
Logs: /usr/local/var/log/elasticsearch/elasticsearch_hitoshimurakami.log
Plugins: /usr/local/var/elasticsearch/plugins/
Config: /usr/local/etc/elasticsearch/
To have launchd start elasticsearch now and restart at login:
brew services start elasticsearch
Or, if you don't want/need a background service you can just run:
elasticsearch
##パスを通す←今回はパス通す必要がなかったのでやめました。
vim ~/.bash_profile
bash_profile
export ELASTICPATH=/usr/local/var/elasticsearch/plugins/
export PATH=$PATH:$ELASTICPATH
##elasticsearch起動
$ cd /usr/local/Cellar/elasticsearch/6.2.4
$ bin/elasticsearch
実行確認。curlしてjsonが正常に返ってきた。
MacBook-Pro:6.2.4 hitoshimurakami$ curl http://localhost:9200
{
"name" : "tnvsi2-",
"cluster_name" : "elasticsearch_hitoshimurakami",
"cluster_uuid" : "CkNLBgkgTvK3gioWuPTKWg",
"version" : {
"number" : "6.2.4",
"build_hash" : "ccec39f",
"build_date" : "2018-04-12T20:37:28.497551Z",
"build_snapshot" : false,
"lucene_version" : "7.2.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
###参考URL
https://qiita.com/y-temp4/items/ffafe1c0ea8a29ce8707
https://qiita.com/nbkn/items/01a11392921119fa0153