1. 程式人生 > 其它 >elasticsearch head +xpack 使用者名稱密碼訪問報錯headers及決絕方案

elasticsearch head +xpack 使用者名稱密碼訪問報錯headers及決絕方案

技術標籤:elasticsearchelasticsearches

剛接觸elasticsearch,由於只是基礎的資料查詢操作,用Kibnan不如head方便。(本文基於:Elasticsearch-7.10.1)
但是設定密碼以後,head總提示錯誤,如下圖:

同源策略禁止讀取位於 http://localhost:9200/_cluster/health 的遠端資源。(原因:CORS 預檢響應的 'Access-Control-Allow-Headers',不允許使用頭 'content-type')。

解決方法:在elasticsearch.yml中增配置內容如下:


http.cors.allow-headers: Content-Type,Accept,Authorization, x-requested-with

設定好以後,瀏覽器輸入

http://host:9100/?auth_user=elastic&auth_password=密碼

就可以訪問了

另附找到的一些其他相關內容,不過我沒用

http.cors.enabled: true
http.cors.allow-credentials: true
http.cors.allow-origin: "*"
http.cors.allow-methods: OPTIONS, HEAD, GET, POST, PUT, DELETE
http.cors.allow-headers: X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization, Access-Control-Allow-Headers, Accept


求大神幫忙:使用Logstash同步Sql Server 2008 的資料到Elasticsearch的時候,原欄位名ItemName形勢的在logstash處理時欄位名全部變成了大寫ITEMNAME。網上找了很久沒有找到解決方案。

求大神指教