I got ' Fielddata is disabled on text fields by default. Set fielddata=true' in my request , but it confused me ,since I put not_analyzed to my field , so it is not a text field , which will support doc_values according to https://www.elastic.co/guide/en/elasticsearch/reference/5.0/fielddata.html#_fielddata_is_disabled_on_literal_text_literal_fields_by_default.
here is part of my template :
"timestamp": {
"format": "epoch_millis",
"type": "date",
"doc_values": true
},
"device_id": {
"index": "not_analyzed",
"type": "string",
"doc_values": true
},
"name_type": {
"type": "integer",
"doc_values": true
}
when I try to request with a aggregtion like :
"aggs": {
"cardinality_count": {
"cardinality": {
"field": "device_id"
}
}
}
but I got failures as :
"reason": {
"type": "illegal_argument_exception",
"reason": "Fielddata is disabled on text fields by default. Set fielddata=true on [device_id] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
}
Any help will be great appreciated !