I want to use a bat file to clear my index in solr. I found the following solution:
https://superuser.com/questions/134685/run-curl-commands-from-windows-console
I downloaded cURL and a copied to my system32 folder. then I openend my windows commandline and typed
curl www.google.com
and it seems to work fine.
then I tried to add the following command:
curl http://berserkerpc:444/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
here the how to from solr:
http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
I got the message back that there is a a syntactic issue with '<' while processing.
here is the complete bat file I want to create:
curl http://berserkerpc:444/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'
curl http://berserkerpc:444/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'
any suggestion how to solve this???
With Curl try calling -
curl -H 'Content-Type: text/xml' http://localhost:8983/solr/update --data-binary '<delete><query>*:*</query></delete>'
Be sure to use commit=true to reflect these changes.
OR Directly from from Browser -
http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true
Related
I am a noob at all this and I am trying to run a Linux curl command in Windows 10 to generate session key. The following is the command in Linux.
curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys"}' http://localhost:9933/
When I run the command at the Windows command prompt I am receiving the following error.
E:\>curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys"}' http://localhost:9933/
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 18:
author_rotateKeys}'
^
E:\>
Any idea how would I covert the command to work with Windows 10? I just need to generate a key for a node I need to connect to from a Windows box.
If you don't have WSL2 setup (useful if you ever need other *nix tools) where that command will just work as is, or don't want to use PowerShell where
curl.exe -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys"}' http://localhost:9933/
works (notice the curl is replaced with curl.exe, because in PowerShell 5.1 curl is just an alias for Invoke-WebRequest, it's removed in PowerShell 6 and later, but they're not built-in and won't replace PowerShell 5.1 when installed), then on Command Prompt replace single quote with double quote, and for double quote inside them, escape it (replace it with \")
curl -H "Content-Type: application/json" -d "{\"id\":1, \"jsonrpc\":\"2.0\", \"method\": \"author_rotateKeys\"}" http://localhost:9933/
i am new to elastic search trying to bulk import accounts.json file with curl command. but every time got error URL not specified.
elasticsearch and kibana folder are on desktop and also accounts.json file also on desktop.
here is the curl command with error
desktop user$ curl -H 'Content-Type: application/json' -XPOST'localhost:9200/bank/_bulk?pretty&refresh' --data-binary '#accounts.json'
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
please help
You need to use this command to bulk import data:
curl -H 'Content-Type: application/json' -XPOST 'localhost:9200/index-name/_bulk?pretty' --data-binary #my_newline_json.json
Make sure that you have correctly specified the path of your json file in the curl command
Refer to this answer, to know more about this.
I'm running Jenkins pipeline job on a windows 10 agent.
i'm trying to publish some information from the agent to confluence.
Running with script.bat:
curl --fail --silent --show-error -u ****:**** -X GET <SomeInternalAddress>
works!
but running:
curl --fail --silent --show-error -u ****:**** -X POST -H 'Content-Type: application/json' -d '#tmpCurlPostData.txt' <SomeInternalAddress>
results with:
curl: (6) Could not resolve host: application
curl: (22) The requested URL returned error: 415
tried escape a '=' in the password with '^'. tried surrounding with quotes.
but with no success.
interesting fact, the same code works fine on win 7,
testing it on a new win 10 machine revealed the problem.
would appreciate any idea guys.
thanks a lot!
I am using the following command to upload file to an endpoint
curl -X POST -H "authorization: Basic base64encode" -H "Content-Type:
multipart/form-data" -H "X-Atlassian-Token: nocheck" -F
"file=#c:/Users/User/Desktop/testresults.xml" https://jira.test-
server.ag/rest/api/latest/issue/man-287/attachments
the command under mac works without problems, under windows I become the following error
curl: (26) read function returned funny value
curl version
curl 7.64.0 (x86_64-w64-mingw32) libcurl/7.64.0 OpenSSL/1.1.1a
installed using https://chocolatey.org
I ran into the same problem when I used curl on the Windows Subsystem for Linux on Windows 10. I had to change the path from C:\Temp\File.txt to /mnt/c/Temp/File.txt.
Check if you can access the file in your shell e.g. with dir c:\path\to\file.txt and if it fails then you know that you have to fix the path first.
I am trying to launch H2O AutoML from command line with CURL and could not get it working..
The base command is something as below:
curl -X POST -H 'application/x-www-form-urlencoded; charset=UTF-8' -d 'training_frame=12cfbae9-af66-42fd-835f-13ccc5a508ab' "http://localhost:54321/99/AutoMLBuilder"
I tried with various parameters with but I always get error as unknown parameter.
I had the use the CURL command as below to make it work:
curl -X POST -H 'Content-Type: application/json' -d '{"input_spec":{"training_frame":"1acfbae9-af66-42fd-835f-13ccc5a508cb","response_column":"mpg","ignored_columns":[],"sort_metric":null},"build_models":{"exclude_algos":[]},"build_control":{"nfolds":5,"keep_cross_validation_predictions":true,"keep_cross_validation_models":true,"balance_classes":false,"class_sampling_factors":[],"max_after_balance_size":5,"stopping_criteria":{"seed":-1,"max_models":0,"max_runtime_secs":30,"stopping_rounds":3,"stopping_tolerance":-1},"project_name":"automl-mpg"}}' http://localhost:54321/99/AutoMLBuilder
Above 1acfbae9-af66-42fd-835f-13ccc5a508cb is the training frame id.