I am trying to index a document into the customer index using the below command as suggested in the elasticsearch guide: curl -XPUT localhost:9200/customer/external/1?Gibbon -d '{ "name": "John Doe"}'
But wen I execute this command, I am getting the below error:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to p arse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by" :{"type":"not_x_content_exception","reason":"Compressor detection can only be ca lled on some xcontent bytes or compressed xcontent bytes"}},"status":400}curl: ( 6) Could not resolve host: name curl: (3) [globbing] unmatched close brace/bracket in column 9
Thanks David but the suggested command did not work. Showing below error:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to p arse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by" :{"type":"not_x_content_exception","reason":"Compressor detection can only be ca lled on some xcontent bytes or compressed xcontent bytes"}},"status":400}curl: ( 6) Could not resolve host: name curl: (3) [globbing] unmatched close brace/bracket in column 9
Ok. So curl on windows really sucks. You should use a REST plugin for your browser to run REST calls.
I personally use SENSE as it allows to copy CURL commands directly.
python requests.put() (and post()) can give you the same error. This thread made me realize that the data=document parameter to requests must be a JSON string and not a dict object.
The dict object gets packed by *requests. Maybe it's always form-encoded. Anyway, Elasticsearch doesn't like it.
I know this is an old post. Just for completeness, windows does not support CURL commands natively. If you wish to use curl commands, I would recommend installing the 3rd party cURL using the following steps:
Extract the file into the c:\windows\system32 folder.
Open a Command prompt, and navigate to c:\windows\system32, and issue the appropriate cURL commands.
However, when in a Powershell console, or ISE, the Invoke-WebRequest cmdlet has an alias called 'curl', so should not be confused with the *nix equivalent. To create an index using Powershell's Invoke-Webrequest, use the following:
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.