在Elastic Cloud平台上使用Elasticsearch服务器,进行CORS配置
我认为在尝试Elasticsearch时,可能会有时候希望快速尝试一下的时候。
这是那时的笔记。
当在Elastic Cloud中创建的Elasticsearch上直接发出查询时,我们(暂时地)开发了一个Web应用程序。然而,默认设置会遇到CORS限制。

添加 Elasticsearch 用户设置 | Elasticsearch 服务文档 | Elastic
1. 登录 Elasticsearch 服务控制台。
在Elasticsearch服务卡的主页上选择您的部署,或者前往部署页面。
从您的部署菜单中,转到编辑页面。
在每个Elasticsearch节点的底部,展开用户设置覆盖的符号。

5. 更新用户设置。 .)
在打开的编辑器部分中添加HTTP设置
http:
cors.enabled: true
cors.allow-origin: /https?:\/\/(localhost(:[0-9]+)?|xxxxx.github.io)/
cors.allow-methods: GET
cors.allow-headers: Authorization, X-Requested-With,X-Auth-Token,Content-Type, Content-Length
只允许以下两种方式的访问设置。
-
- localhost
- xxxxx.github.io

6. 点击保存更改。

点击保存按钮后,服务器将开始更新。

当加载完毕后,设置将会生效。

控制台日志中也不再显示错误了。

请提供相关的英文原文,我将为您进行中文的同义转述。
添加Elasticsearch用户设置 | Elasticsearch服务文档 | Elastic
HTTP | Elasticsearch 参考[7.9] | Elastic
YML配置 – Elasticsearch实例| 阿里云文档中心