0

I have problem with the uploading of index in Elasticsearch.

curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d "{\"mappings\":{\"timestamp\":{\"type\":\"date\",\"format\":\"yyyy-MM-dd\"}}}"

I get this error:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [format : yyyy-MM-dd] [type : date]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [timestamp]: Root mapping definition has unsupported parameters:  [format : yyyy-MM-dd] [type : date]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [format : yyyy-MM-dd] [type : date]"}},"status":400}

Why is my curl command wrong?

Thanks.

Filippo Leoncini
  • 347
  • 3
  • 15
  • Possible duplicate of [Elasticsearch : Root mapping definition has unsupported parameters index : not\_analyzed](https://stackoverflow.com/questions/39288997/elasticsearch-root-mapping-definition-has-unsupported-parameters-index-not-a) – Issam El-atif May 24 '17 at 14:07

1 Answers1

1

You're missing the type declaration:

curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d '{
   "mappings":{
     "your_type_name": {                <--- add this
         "properties": {                <--- and this
            "timestamp":{
              "type":"date",
              "format":"yyyy-MM-dd"
            }
         }
      }        
   }
}'
Val
  • 207,596
  • 13
  • 358
  • 360
  • You are right. Indeed I have corrected it in :curl -H "Content-Type: application/json" -XPUT http://localhost:9200/technogym_error_timeline -d "{\"mappings\": {\"_default_\":{\"properties\":{\"timestamp\":{\"type\":\"date\",\"format\":\"yyyy-MM-dd\"}}}}}". Thanks – Filippo Leoncini May 24 '17 at 14:09