O'Leg
O'Leg

Reputation: 99

Getting Fielddata is disabled on text fields by default for the "keyword" field

I am getting Fielddata is disabled on text fields by default for the field os the type "keyword".

Is this an expected behaviour?

The problem that I cannot fix the issue with the recommended approach (Set fielddata=true), since it throws: Mapping definition for [xxx] has unsupported parameters: [fielddata : true]

Upvotes: 1

Views: 1702

Answers (1)

Oleksi
Oleksi

Reputation: 13097

According to the elasicsearch documentation, this is the default for performance reasons.

Fielddata can consume a lot of heap space, especially when loading high cardinality text fields.

You can enable it like this:

PUT my_index/_mapping
{
  "properties": {
    "my_field": { 
      "type":     "text",
      "fielddata": true
    }
  }
}

https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html

Upvotes: 2

Related Questions