My field is doc_value , but got error : Fielddata is disabled on text fields by default. Set fielddata=true

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 !

1 Like

anyway, when I set my mapping before post data to it , the queries work ! but I have so much data generated with ES2.1.0 , so how can I make it ?

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