Skip to content

Add the type hint _class attribute to the index mapping #1711

Closed
@sothawo

Description

@sothawo

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
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions