简体   繁体   English

如何“要求” .yml文件?

[英]How to “require” a .yml file?

I'm a beginner just trying to get the hang of elasticsearch with angular and have installed elasticsearch with the browserbuild here: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/browser-builds.html 我是一个初学者,只是想尝试一下用角来学习elasticsearch,并在这里的浏览器中安装了elasticsearch: https ://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/browser- builds.html

I was able to get elasticsearch loaded into angular as a module and was following along with this sample repo: https://github.com/spalger/elasticsearch-angular-example/blob/master/README.md 我能够将Elasticsearch作为模块加载到angular中,并跟随此示例存储库: https : //github.com/spalger/elasticsearch-angular-example/blob/master/README.md

When I tried to run the cluster.state call, I received the following error: Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response. 当我尝试运行cluster.state调用时,收到以下错误:请求标头字段在飞行前响应中,Access-Control-Allow-Headers不允许进行授权。

According to the sample repo, I need to configure the elasticsearch.yml file in order to allow CORS. 根据样本存储库,我需要配置elasticsearch.yml文件以允许CORS。 I couldn't seem to find this file so I created my own but how do I now get my js files to "require" or "read" from it? 我似乎找不到此文件,所以我创建了自己的文件,但是现在如何使我的js文件“需要”或“读取”呢?

This is the configuration file for elasticsearch. 这是elasticsearch的配置文件。 It does not belong to the client. 它不属于客户端。
Read about elasticsearch installation in their site and setup your development elasticsearch server to work against. 在他们的站点上了解有关Elasticsearch安装的信息,并设置您的开发Elasticsearch服务器可以使用。
Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM