Error: smtp.host must be configured in elasticsearch.yml

Error: smtp.host must be configured in elasticsearch.yml

我想将 Watcher 插件与 elasticsearch 集成。因此,为此,我在 elasticsearch.yml:

中添加了以下配置
watcher.actions.email.service.account:
  outlook_account:
    profile: outlook
  smtp:
    auth: true
    starttls.enable: true
    host: smtp-mail.outlook.com
    port: 587
    user: abc@example.com
    password: abc

但是当我 运行 使用 bin/elasticsearch elasticsearch 时,它给了我这个:

L-IDC1ZCG3QC-M:elasticsearch-2.2.0 pgoel$ bin/elasticsearch
[2016-05-18 17:50:43,783][INFO ][node                     ] [Rocket Raccoon] version[2.2.0], pid[5189], build[8ff36d1/2016-01-27T13:32:39Z]
[2016-05-18 17:50:43,783][INFO ][node                     ] [Rocket Raccoon] initializing ...
[2016-05-18 17:50:44,183][INFO ][plugins                  ] [Rocket Raccoon] modules [lang-expression, lang-groovy], plugins [watcher, license], sites []
[2016-05-18 17:50:44,202][INFO ][env                      ] [Rocket Raccoon] using [1] data paths, mounts [[/ (/dev/disk1)]], net usable_space [182.6gb], net total_space [232.6gb], spins? [unknown], types [hfs]
[2016-05-18 17:50:44,202][INFO ][env                      ] [Rocket Raccoon] heap size [989.8mb], compressed ordinary object pointers [true]
[2016-05-18 17:50:44,232][INFO ][watcher.trigger.schedule ] [Rocket Raccoon] using [ticker] schedule trigger engine
[2016-05-18 17:50:45,534][INFO ][node                     ] [Rocket Raccoon] initialized
[2016-05-18 17:50:45,534][INFO ][node                     ] [Rocket Raccoon] starting ...
Exception in thread "main" SettingsException[missing required email account setting for account [smtp]. 'smtp.host' must be configured]
    at org.elasticsearch.watcher.actions.email.service.Account$Config.<init>(Account.java:182)
    at org.elasticsearch.watcher.actions.email.service.Accounts.<init>(Accounts.java:40)
    at org.elasticsearch.watcher.actions.email.service.InternalEmailService.createAccounts(InternalEmailService.java:109)
    at org.elasticsearch.watcher.actions.email.service.InternalEmailService.reset(InternalEmailService.java:105)
    at org.elasticsearch.watcher.actions.email.service.InternalEmailService.doStart(InternalEmailService.java:55)
    at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)
    at org.elasticsearch.node.Node.start(Node.java:242)
    at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:221)
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:287)
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
[2016-05-18 17:50:45,547][INFO ][node                     ] [Rocket Raccoon] stopping ...
[2016-05-18 17:50:45,548][INFO ][node                     ] [Rocket Raccoon] stopped
[2016-05-18 17:50:45,548][INFO ][node                     ] [Rocket Raccoon] closing ...
[2016-05-18 17:50:45,552][INFO ][node                     ] [Rocket Raccoon] closed
L-IDC1ZCG3QC-M:elasticsearch-2.2.0 pgoel$ 

有人可以帮助我吗?我哪里做错了?

你的缩进错了(yaml 对此很挑剔),smtp 部分应该在 outlook_account 部分下面。

watcher.actions.email.service.account:
  outlook_account:
    profile: outlook
    smtp:
      auth: true
      starttls.enable: true
      host: smtp-mail.outlook.com
      port: 587
      user: abc@example.com
      password: abc

试试这个(正确的缩进)并确保你没有制表符(只有空格):

watcher.actions.email.service.account: 
  outlook_account: 
    profile: outlook
    smtp: 
      auth: true
      host: smtp-mail.outlook.com
      password: abc
      port: 587
      starttls.enable: true
      user: abc@example.com