Use the entity name instead of the class name as default index name

Description

Currently, when an entity is indexed but is not assigned an index name, by default, we use the fully qualified class name.

It's nice because the class name is unique, but the result index names are really not user-friendly, especially in the case of Elasticsearch, where users are likely to send requests to the cluster using the REST API:

1 curl -XPOST -H "Content-Type: application/json" localhost:9200/org.hibernate.search.documentation.searchdsl.predicate.book/_analyze\?pretty -d'{"analyzer":"autocomplete_query","text":"robo"}'

We could switch to using the entity name instead. In Hibernate ORM, the entity name is either specified by the user or defaults to the "unqualified name of the entity class". In both cases, it is assumed to be unique, and this uniqueness is actually checked by Hibernate ORM.

The result would be default index names that are easier to read and to work with. It would also provide better resilience to refactoring of user code by default, since moving an entity to a different package would no longer change the default index name.

The main drawback is the breaking changes: users of Search 6.0.0.Alpha9 would have to rename their indexes manually, or drop them and reindex everything. But then, it was an Alpha.

Environment

None

Status

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Fix versions

Priority

Major
Configure