0

麋鹿 7.X

我正在尝试使用输入文件创建带有 curl 的弹性搜索观察器。像这样的东西

curl -X PUT _watcher/watch/cluster_health_watch --data-binary @inputFile

1)要使用的文件类型是什么?大部分数据是json,但是在发送邮件的“actions”字段中,邮件正文可以是HTML!

2) 有什么方法可以从外部文件引用正文中的 HTML,这样输入文件可以是 json ?

4

1 回答 1

0

只需通过添加“\”来转义 html 字符串中的双引号。

前任:-

<h3 style=\"color:red\"></h3>
"actions": {
    "send_email": {
      "email": {
        "to": "xxxx@gmail.com",
        "subject": "My Subject",
        "body": {
          "html": "<h3 style=\"color:red\"> There was a problem</h3>"
        }
      }
    }
  }
curl -X PUT _watcher/watch/cluster_health_watch -H 'Content-Type: application/json' --data-binary @inputFile.json
于 2020-04-20T12:39:16.953 回答