Logstash7.4.2 shutsdown when run from command line attached to elastic search

New to using Elastic search and logstash. I installed elasticsearch and logstash on windows. Started Elasticsearch on localhost without any issues. I was able to get the response at port 9200 as expected.

I installed logstash next and tried to start logstash with elasticsearch as output and taking input from command line. Logstash starts ok but shoutsdown after few seconds before I could type anything for input. If I don't use elasticsearch for output then it works ok.

Here's the log output on the terminal window when I start logstash.

PS E:\logstash-7.4.2> bin/logstash -e 'input { stdin { } } output { elasticsearch {hosts => ["localhost:9200"]} stdout {} }'
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.runtime.encoding.EncodingService (file:/E:/logstash-7.4.2/logstash-core/lib/jars/jruby-complete- to field java.io.Console.cs
WARNING: Please consider reporting this to the maintainers of org.jruby.runtime.encoding.EncodingService
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Thread.exclusive is deprecated, use Thread::Mutex
Sending Logstash logs to E:/logstash-7.4.2/logs which is now configured via log4j2.properties
[2019-11-23T15:34:00,816][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2019-11-23T15:34:00,831][INFO ][logstash.runner ] Starting Logstash {"logstash.version"=>"7.4.2"}
[2019-11-23T15:34:01,701][ERROR][logstash.agent ] Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main, :exception=>"LogStash::ConfigurationError", :message=>"Expected one of #, {, ,, ] at line 1, column 64 (byte 64) after output { elasticsearch {hosts => [localhost", :backtrace=>["E:/logstash-7.4.2/logstash-core/lib/logstash/compiler.rb:41:in compile_imperative'", "E:/logstash-7.4.2/logstash-core/lib/logstash/compiler.rb:49:in compile_graph'", "E:/logstash-7.4.2/logstash-core/lib/logstash/compiler.rb:11:in block in compile_sources'", "org/jruby/RubyArray.java:2584:in map'", "E:/logstash-7.4.2/logstash-core/lib/logstash/compiler.rb:10:in compile_sources'", "org/logstash/execution/AbstractPipelineExt.java:153:in initialize'", "org/logstash/execution/JavaBasePipelineExt.java:47:in i nitialize'", "E:/logstash-7.4.2/logstash-core/lib/logstash/java_pipeline.rb:26:in initialize'", "E:/logstash-7.4.2/logstash-core/lib/logstash/pipeline_action/create.rb:36:in execute'", "E:/logstash-7.4.2/logstash-core/lib/logstash/agent.rb:326:in block in converge_state'"]}
[2019-11-23T15:34:02,129][INFO ][logstash.agent ] Successfully started Logstash API endpoint {:port=>9600}
[2019-11-23T15:34:07,006][INFO ][logstash.runner ] Logstash shut down.
PS E:\logstash-7.4.2>

The hostname should be in double quotes. You could get this error if you are missing a quote earlier in the file.

Moved the configuration to a file and worked fine, not sure why. Thanks for your help.