Mapper_parsing_exception while creating Percentage

When i am trying to create a column with format as Percentage it throws an error like this:

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "No handler for type [number] declared on field [fieldez_percentage]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [default]: No handler for type [number] declared on field [fieldez_percentage]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "No handler for type [number] declared on field [fieldez_percentage]"
}
},
"status": 400
}

The code is:

PUT /average_attendance_dummy
{
"mappings": {
"default": {
"properties": {
"fieldez_percentage": {
"type": "number",
"format": "Percentage"
}
}
}
}
}

Please help me to solve the error...

IPlease format your code using </> icon as explained in this guide. It will make your post more readable.

Or use markdown style like:

```
CODE
```

There is nothing like number in the documentation Same for format. Where did you see that? See https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html

Actually what i want to do is i have to add one column to store percentage values always like geo_point does. So that i am doing this. Is this way correct or not?

No. It’s not correct. But you know that as you get an error message.

Modify your document and just store an integer which represents the percentage like 20 instead of 20%

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