[hibernate-dev] [Search] Providing an alias for the indexed type

Yoann Rodiere yoann at hibernate.org
Wed Nov 15 09:26:03 EST 2017


Indeed it would make sense to allow custom type names, in particular in ES
5 and below.

In Elasticsearch 6, you can only have one type per index. The main impact
is that we will have to choose between two solutions:

   1. Either we continue as before (multiple types per index), but we
   somehow merge multiple Java types into one Elasticsearch type (we merge the
   mappings together), and we add a Hibernate Search specific field to
   distinguish between types.
   2. Or we go the Elasticsearch way and just create one index per Java type

If we go solution 2, then customizing the type name may not be necessary:
we could probably use the index name as a type name. But custom type names
wouldn't hurt.

> I probably wouldn't introduce a new annotation now, unless it matches
our intent in 6.

+1 let's wait for 6, and in particular let's wait until we support ES6... I
wouldn't want to add annotations just to drop them on the next release.


Yoann Rodière
Hibernate NoORM Team
yoann at hibernate.org

On 7 November 2017 at 22:43, Sanne Grinovero <sanne at hibernate.org> wrote:

> +1 we should allow to override this.
>
> I think it's material for 6.x , as it ties in with the plans for
> decoupling the "index schema definition" from the "indexed type", but
> we could introduce a configuration property already in the current
> master - something like a type alias.
>
> I probably wouldn't introduce a new annotation now, unless it matches
> our intent in 6.
>
>
> On 7 November 2017 at 16:13, Guillaume Smet <guillaume.smet at gmail.com>
> wrote:
> > Hi,
> >
> > We just had a couple of very similar questions on SO:
> > https://stackoverflow.com/questions/47107499/override-
> elasticsearch-type-in-hibernate-search/47160930
> > https://stackoverflow.com/questions/47160030/how-to-
> configure-type-name-or-filter-by-type-query-with-elasticsearch-integratio
> >
> > The first use case makes more sense than the second one but I'm wondering
> > if we should consider adding some sort of alias to @Indexed to override
> the
> > type we use to identify the type of an object.
> >
> > WDYT?
> >
> > --
> > Guillaume
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>


More information about the hibernate-dev mailing list