Closed
Description
Spring Data Elasticsearch use type hints to store information in the index about the persisted entity's class. This is the fully qualified name of the entity's class, stored in a field named _class
.
This field is not defined in the index mappings, so it is automatically mapped by Elasticsearch when the first entity is persisted to the following definition:
"_class": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
This field is never used for search, so it does not need to be analyzed or indexed at all. Having it mapped in this way is a waste of storage place and indexing time.
The type hint field should be defined in the mapping as
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
}