Logstash can't connect to Elasticsearch: java.net.SocketException: Connection reset

On a Windows machine, I am trying to add some data with Logstash to Elasticsearch, using the following output configuration in logstash.conf:

output {
    elasticsearch { 
        hosts => "https://localhost:9200"
        ssl => true
        ssl_certificate_verification => false
        user => logstash
        password => logstash
        ilm_enabled => false
        index => "logstash"

The logstash.bat executes without errors, although with some warnings.

However, from field audit_request_exception_stacktrace, I get the following in Kibana:

java.net.SocketException: Connection reset at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:345) at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:376) at org.elasticsearch.transport.CopyBytesSocketChannel.readFromSocketChannel(CopyBytesSocketChannel.java:141)

As shown in the following picture:

Connection reset simply means that a TCP RST was received. This happens when your peer receives data that it can’t process, and there can be various reasons for that. The simplest is when you close the socket, and then write more data on the output stream. By closing the socket, you told your peer that you are done talking, and it can forget about your connection. When you send more data on that stream anyway, the peer rejects it with an RST to let you know it isn’t listening.