Mapper parser exception when creating an index with mapping

I am getting error when running the following command. I am a noob please help me.
command :
PUT /companydatabase?pretty { "mappings": { "employees": { "properties": { "FirstName": { "type": "text" }, "LastName": { "type": "text" }, "Designation": { "type": "text" }, "Salary": { "type": "integer" }, "DateOfJoining": { "type": "date", "format": "yyyy-MM-dd" }, "Address": { "type": "text" }, "Gender": { "type": "text" }, "Age": { "type": "integer" }, "MaritalStatus": { "type": "text" }, "Interests": { "type": "text" } } } } }

The error :
{ "error" : { "root_cause" : [ { "type" : "mapper_parsing_exception", "reason" : "Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]" } ], "type" : "mapper_parsing_exception", "reason" : "Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]", "caused_by" : { "type" : "mapper_parsing_exception", "reason" : "Root mapping definition has unsupported parameters: [employees : {properties={Designation={type=text}, Salary={type=integer}, MaritalStatus={type=text}, DateOfJoining={format=yyyy-MM-dd, type=date}, Address={type=text}, FirstName={type=text}, LastName={type=text}, Gender={type=text}, Age={type=integer}, Interests={type=text}}}]" } }, "status" : 400 }

Welcome!

I guess you're on 7.x.

Remove employees as types have been removed.

I am sorry. I don't understand.
Should I remove employees?

You should remove the employees key from your json.

PUT /companydatabase
{ "mappings": { "properties": { "FirstName": { "type": "text" }, "LastName": { "type": "text" }, "Designation": { "type": "text" }, "Salary": { "type": "integer" }, "DateOfJoining": { "type": "date", "format": "yyyy-MM-dd" }, "Address": { "type": "text" }, "Gender": { "type": "text" }, "Age": { "type": "integer" }, "MaritalStatus": { "type": "text" }, "Interests": { "type": "text" } } } }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.