Adding a test message in the Elasticsearch database by running AddMessageToElasticSearch.ps1 gives header content type issue

Power shell Script : AddMessageToElasticSearch.ps1

Studio/Robot version: 2018

Elastic search version: 6.0

Current behavior: Test is not successful due to unsupported content type

Elastic search 6.0 is installed and before creating indexes in Kibana, a test script to send message to elastic search database is executed. Test is not successful due to unsupported content type. Should we downgrade the version of Elastic search to 5.0 just for testing failure?

Hi Sumesh,

In the last line of the script, add -ContentType ā€˜application/jsonā€™.

So the whole line will look like this:
Invoke-WebRequest -Uri $WebRequestPath -ContentType 'application/json' -Method POST -Body (ConvertTo-Json $messageBody)

Please try this and let me know if it works for you.


Hello Ovi,

It worked. Thanks


Thatā€™s great!