Mapper_parsing_exception : Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes

Viewed 10233

I am using elasticsearch [version 6.4.0].I am trying to index a simple customer document into the customer index.My query is

  curl -X PUT "localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" -d'
{
  "name": "John Doe"
}
'

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse",
    "caused_by" : {
      "type" : "not_x_content_exception",
      "reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
    }
  },
  "status" : 400
}
2 Answers

Use below command..

curl -H "Content-Type: application/json" -X PUT localhost:9200/customer/_doc/1?pretty -d "{\\"Name\\":\\"John Doe\\"}"

Try:

curl -XPOST http://localhost:9200/customer/_doc -d '{"name":"John Doe"}' -H 'Content-Type: application/json'
Related