• Register
1 vote
233 views

Problem :

Getting following error related to content-type header
{"error":"content-type header [application/x-www-form-urlencoded] is not supported","status":406}
How to resolve it?
6.9k points
reopened by

1 Answer

1 vote
 
Best answer

Solution :

Please change the enclosing quotes from ' to " also escape the quotation marks " used inside the parameters as below and run the curl command :

curl -XGET gitlab.server:9200/ -H "Content-Type: application/json" -d "{\"query\": {\"simple_query_string\" : {\"fields\" : [\"content\"], \"query\" : \"foo bar -baz\"}}}"

An alternative is also available to put the json into a file, and use the @ prefix for the parameters.

json.txt

{
  "query": {
    "simple_query_string" : { 
      "fields" : ["content"], 
      "query" : "foo bar -baz"
    }
  }
}

After doing that run the curl command as below:

curl -XGET gitlab.server:9200/ -H "Content-Type: application/json" -d @json.txt
36.1k points
selected by

Related questions

0 votes
1 answer 571 views
571 views
Problem : I am very new to Curl. I have recently started learning Curl. Whenever I try to connect to the Elasticsearch using below command curl http://localhost:9200 it is working properly. But when I try to run the following command curl http://IpAddress: ... showing me below error “Curl: (7) failed to connect to localhost port 9200: connection refused” How can I resolve above error?
asked Feb 20 mphil 2.3k points
0 votes
1 answer 1.4K views
1.4K views
Problem : Currently I am trying to create a heatmap using a ggmosaic, But I keep facing below error “Error in is.finite(x) : default method not implemented for type 'list'” My Configuration is Windows, RStudio, R version mostly one before a most recent, and ggmosaic Ver 0.1.2 How can I fix the above error?
asked Feb 20 mphil 2.3k points
0 votes
1 answer 8 views
8 views
Problem: I am a na&iuml;ve to Java, Jsp, Servlet and trying to make a very small registration program with the database. But while trying to run this I am facing below errors: HTTP Status 405 - HTTP method GET is not supported by this URL type Status report message HTTP ... </welcome-file>     </welcome-file-list> </web-app> I am looking for Java expert who can help me in fixing above error.
asked Jul 29 Raphael Pacheco 2.6k points
0 votes
1 answer 41 views
41 views
Problem : I am getting bellow Wordpress error download failed. error:0d0890a1:asn1 encoding routines:asn1_verify:unknown message digest algorithm
asked Nov 7, 2019 peterlaw 6.9k points
0 votes
1 answer 146 views
146 views
Problem : I am facing an issue with a systemd config for ElasticSearch as follows: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
asked Nov 18, 2019 peterlaw 6.9k points