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.

1

1 Answer 1

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"
            }
         }
      }        
   }
}'
Sign up to request clarification or add additional context in comments.

1 Comment

You are right. Indeed I have corrected it in :curl -H "Content-Type: application/json" -XPUT localhost:9200/technogym_error_timeline -d "{\"mappings\": {\"_default_\":{\"properties\":{\"timestamp\":{\"type\":\"date\",\"format\":\"yyyy-MM-dd\"}}}}}". Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.