es版本:6.3.2
查看許可狀態(tài)

可以看到是basic,需要啟用 trial license
curl -H "Content-Type:application/json" -XPOST http://<host>:<port>/_xpack/license/start_trial?acknowledge=true
然后在elasticsearch.yml文件中增加如下配置:
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true
重啟es,然后執(zhí)行.\elasticsearch-setup-passwords.bat interactive設(shè)置密碼。
如果沒加xpack的配置,直接設(shè)置密碼會報錯,如下:
Unexpected response code [403] from calling GET http://*.*.*.*:9200/_xpack/security/_authenticate?pretty
It doesn't look like the X-Pack security feature is available on this Elasticsearch node.
Please check if you have installed a license that allows access to X-Pack Security feature.
ERROR: X-Pack Security is not available.
執(zhí)行.\curl.exe http://<host>:<port>測試連接,報錯,連接失敗。
然后再執(zhí)行.\curl.exe http://<host>:<port> -u elastic:<password>連接成功。
或者也可以直接瀏覽器訪問http://<host>:<port>驗證結(jié)果。