Issue with index - set fielddata=true

Hello,

When working with my dashboards I got this error message:

"Text fields are not optimised for operations that require per-document field data like aggregations and sorting, so these operations are disabled by default. Please use a keyword field instead. Alternatively, set fielddata=true on [rule.id] in order to load field data by uninverting the inverted index. Note that this can use significant memory."

I try to update that field with:

PUT my-index/_mapping

{
  "properties": {
    "rule.id": { 
      "type":     "keyword",
      "fielddata": true
    }
  }
}

I got as a result:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "unknown parameter [fielddata] on mapper [id] of type [keyword]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: unknown parameter [fielddata] on mapper [id] of type [keyword]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "unknown parameter [fielddata] on mapper [id] of type [keyword]"
    }
  },
  "status" : 400
}

I checked and this field's type is text, keyword.
Is that the reason I cannot update the fielddate to true?
Any ideas how to solve that?

Regards,
P

2 points.

  1. You can't change existing mappings (possibly {"rule.id": {"type": "text"}}).
  2. {"fielddata": true} is a parapeter for only text field.

Please try,

PUT my-index/_mapping
{
  "properties": {
    "rule.id": { 
      "type":     "text",
      "fielddata": true
    }
  }
}
1 Like

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