I am running an Apache Solr tutorial from here:
http://lucene.apache.org/solr/guide/7_6/solr-tutorial.html
Solr is running and I can run queries in a web browser.
The tutorial mentions cURL
which I am unfamiliar with.
I have unzipped CURL
to C:\Curl
and included Curl in the PATH environment variable
: C:\Curl\curl-7.63.0-win64-mingw\bin
I am getting an error when running the Command below in a Windows command prompt. I have googled to try and find a resolution to no avail:
Code below:
C:\Curl\curl-7.63.0-win64-mingw\bin>curl -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"name", "type":"text_general", "multiValued":false, "stored":true}}' http://localhost:8983/solr/films/schema
generates the following error:
curl: (3) unmatched brace in URL position 1:
{name:name,
^
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched close brace/bracket in URL position 12:
stored:true}}'
^
{
"responseHeader":{
"status":400,
"QTime":1},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"no stream",
"code":400}}
I tried adding a -g
to turn off globbing.
curl -g -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"name", "type":"text_general", "multiValued":false, "stored":true}}' http://localhost:8983/solr/films/schema
This generated an almost identical error:
C:\Curl\curl-7.63.0-win64-mingw\bin>curl -g -X POST -H 'Content-type:application/json' --data-binary '{"add-field": {"name":"name", "type":"text_general", "multiValued":false, "stored":true}}' http://localhost:8983/solr/films/schema
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
{
"responseHeader":{
"status":400,
"QTime":1},
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.common.SolrException"],
"msg":"no stream",
"code":400}}
I then tried removing the single quotes and escaping the double quotes, but then got the below error:
curl -g -X POST -H Content-type:application/json --data-binary {\"add-field\": {\"name\":\"name\", \"type\":\"text_general\", \"multiValued\":false, \"stored\":true}} http://localhost:8983/solr/films/schema
curl: (3) URL using bad/illegal format or missing URL curl: (3) URL using bad/illegal format or missing URL curl: (3) URL using bad/illegal format or missing URL curl: (3) URL using bad/illegal format or missing URL { "responseHeader":{ "status":500, "QTime":4}, "error":{ "msg":"Premature EOF: char=(EOF),position=11 AFTER=''", "trace":"org.noggit.JSONParser$ParseException: Premature EOF: char=(EOF),position=11 AFTER=''\r\n\tat org.noggit.JSONParser.err(JSONParser.java:419)\r\n\tat org.noggit.JSONParser.next(JSONParser.j ava:973)\r\n\tat org.noggit.JSONParser.nextEvent(JSONParser.java:1061)\r\n\tat org.apache.solr.common.util.CommandOperation.parse(CommandOperation.java:285)\r\n\tat org.apache.solr.common.util.Command Operation.readCommands(CommandOperation.java:350)\r\n\tat org.apache.solr.common.util.CommandOperation.readCommands(CommandOperation.java:326)\r\n\tat org.apache.solr.api.ApiBag.getCommandOperations(A piBag.java:289)\r\n\tat org.apache.solr.servlet.HttpSolrCall.getCommands(HttpSolrCall.java:1073)\r\n\tat org.apache.solr.servlet.SolrRequestParsers$1.getCommands(SolrRequestParsers.java:245)\r\n\tat o rg.apache.solr.schema.SchemaManager.performOperations(SchemaManager.java:77)\r\n\tat org.apache.solr.handler.SchemaHandler.handleRequestBody(SchemaHandler.java:90)\r\n\tat org.apache.solr.handler.Requ estHandlerBase.handleRequest(RequestHandlerBase.java:199)\r\n\tat org.apache.solr.core.SolrCore.execute(SolrCore.java:2541)\r\n\tat org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:709)\ r\n\tat org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:515)\r\n\tat org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:377)\r\n\tat org.apache.solr.servlet.SolrDi spatchFilter.doFilter(SolrDispatchFilter.java:323)\r\n\tat org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doHa ndle(ServletHandler.java:533)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)\r\n\tat org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)\ r\n\tat org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)\r\n\tat org.eclipse.je tty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)\r\n\tat org.eclipse.jetty.server.handler. ContextHandler.doHandle(ContextHandler.java:1317)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)\r\n\tat org.eclipse.jetty.servlet.ServletHandler.doScope(Serv letHandler.java:473)\r\n\tat org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)\ r\n\tat org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)\r\n\tat org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)\r\n\tat org.eclipse.jett y.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)\r\n\tat org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)\r\n\tat org.eclipse.je tty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)\r\n\tat org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:335)\r\n\tat org.eclipse.jetty.server.handler.Hand lerWrapper.handle(HandlerWrapper.java:132)\r\n\tat org.eclipse.jetty.server.Server.handle(Server.java:531)\r\n\tat org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)\r\n\tat org.eclipse .jetty.server.HttpConnection.onFillable(HttpConnection.java:260)\r\n\tat org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)\r\n\tat org.eclipse.jetty.io.FillIn terest.fillable(FillInterest.java:102)\r\n\tat org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)\r\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill .java:333)\r\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)\r\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java :168)\r\n\tat org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)\r\n\tat org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor. java:366)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)\r\n\tat org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)\r\n\tat java. lang.Thread.run(Unknown Source)\r\n", "code":500}}
I know there are a lot of similar Q&A's on SO regarding this issue but they are not quite the same and none of the solutions I have tried resolve my issue.