Logstash http_poller body calls the SQL API of elasticsearch error

Hi
I used logstash http_ poller calls the SQL API of elasticsearch. SQL API _sql?format=txt error.
The following is some configuration information.
input {
http_poller {
urls => {
item => {
method => post
url => "http://localhost:9205/_sql?format=txt"
body => '{"query": "SELECT * FROM test"}'
headers => {
Accept => "text/plain"
"content-type" => "text/plain"
}
}
}
schedule => { cron => "*/2 * * * * *"}
}
}
The following is the error message.
{
"@version" => "1",
"error" => "Content-Type header [text/plain] is not supported",
"status" => 406,
"@timestamp" => 2021-08-20T07:13:58.257Z
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.