Mac brew ElasticSearch  6.7.0

MacでElasticSearchを使う投稿を参考に設定してました。
https://qiita.com/makaishi2/items/598d24ea65e6ec79f887

`brew upgrade`で`6.7.0`アップデート後に起動していない様子。

確認すると色が黄色で表示されている。
![CleanShot 2019-05-16 at 15.03.01.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/17043/8c84d5fc-dd8b-113c-10cb-93e34cf3bd06.png)

`elasticsearch`コマンドを実行すると以下のエラーを吐きます。

```
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file logs/gc.log due to No such file or directory

[2019-05-16T14:37:07,724][INFO ][o.e.e.NodeEnvironment    ] [0ulJ4DR] using [1] data paths, mounts [[/ (/dev/disk1s1)]], net usable_space [114.5gb], net total_space [465.7gb], types [apfs]
[2019-05-16T14:37:07,735][INFO ][o.e.e.NodeEnvironment    ] [0ulJ4DR] heap size [990.7mb], compressed ordinary object pointers [true]
[2019-05-16T14:37:07,797][INFO ][o.e.n.Node               ] [0ulJ4DR] node name derived from node ID [0ulJ4DRVTe-pQdf-5Vt8TA]; set [node.name] to override
[2019-05-16T14:37:07,798][INFO ][o.e.n.Node               ] [0ulJ4DR] version[6.7.2], pid[22831], build[oss/tar/56c6e48/2019-04-29T09:05:50.290371Z], OS[Mac OS X/10.14.4/x86_64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_202/25.202-b08]
[2019-05-16T14:37:07,798][INFO ][o.e.n.Node               ] [0ulJ4DR] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/var/folders/78/v1fw4bvn6yjdr11ctq1vhzj00000gn/T/elasticsearch-561517785160027786, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/usr/local/Cellar/elasticsearch/6.7.2/libexec, -Des.path.conf=/usr/local/etc/elasticsearch, -Des.distribution.flavor=oss, -Des.distribution.type=tar]
[2019-05-16T14:37:09,744][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [0ulJ4DR] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalArgumentException: Plugin [analysis-icu] was built for Elasticsearch version 6.7.0 but version 6.7.2 is running
```

## 直す

色々触った結果動いたのでやったことを記載します（順不同かもなので羅列します）。

```
$ cd /usr/local/Cellar/elasticsearch/6.7.0
$ bin/elasticsearch-plugin remove analysis-icu
$ bin/elasticsearch-plugin install analysis-icu
$ bin/elasticsearch-plugin remove analysis-kuromoji
$ bin/elasticsearch-plugin install analysis-kuromoji
```

起動確認を以下のコマンドでしてみる。

```
$ elasticsearch
```

以下のエラーが出たので、 `elasticsearch_kntmrkm` を削除したら起動した。

```
ERROR: Cluster name [elasticsearch_kntmrkm] subdirectory exists in data paths [/usr/local/var/lib/elasticsearch/elasticsearch_kntmrkm]. All data under these paths must be moved up one directory to paths [/usr/local/var/lib/elasticsearch]
```

上記削除後には再起動が必要だった。

```
$ brew services restart elasticsearch
```

`localhost:9200`でアクセスの確認をする。