docker弹性search不启动
我在我的angular度应用程序中从弹性search中检索细节。 当我在我的本地机器上安装弹性search时工作。 我不得不将以下几行添加到elasticsearch.yml文件中,以使其与angularApp一起工作。
http.cors.allow-origin: "/.*/" http.cors.enabled: true
现在弹性search服务器与docker一起安装。 当我没有添加这两行时,它也工作。 但是,当我添加并重新启动弹性search,它给了我以下错误。
{1.4.2}: Setup Failed ... - SettingsException[Failed to load settings from [file:/elasticsearch/config/elasticsearch.yml]] ScannerException[while scanning a simple key; could not found expected ':'; in 'reader', line 7, column 3: http.cors.enabled: true ^] org.elasticsearch.common.settings.SettingsException: Failed to load settings from [file:/elasticsearch/config/elasticsearch.yml] at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:947) at org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:931) at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:77) at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:106) at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:177) at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32) Caused by: while scanning a simple key in 'reader', line 6, column 3: http.cors.allow-origin:"/.*/" ^
这是服务器上的Elasticsearch.yml文件
至less有两个可能的问题,不是相互排斥的:
第一:
http.cors.allow-origin:"/.*/"
应该是真的
http.cors.allow-origin: "/.*/"
因为YAML表示法要求:
和键值对之间的空格分隔。
其次,你提供的错误跟踪表明在http.cors.allow-origin: "/.*/"
有一个空白区域,这个区域和每个正确的YAML表示法不一致。 http.cors.allow-origin: "/.*/"
更有可能http.cors.allow-origin: "/.*/"
前导空格(因为我认为http
通常是Elasticsearchconfiguration文件中的顶层块)。