We're updating the issue view to help you get more done. 

No search results in multi tenancy mode for tenants with hyphens

Description

We recently updated Hibernate Search from 5.10.5 to 5.11.0/1. During the last update of our application, we altered index mappings and dropped the index. On startup, the index was created and re-indexing worked as expected. But executing any search for a tenant with a hyphen ("-") in its name returns no results.

What we're seeing is that Hibernate 5.10.5 generates the field __HSearch_TenantId like this:

1 2 3 4 5 6 ... "properties": { "__HSearch_TenantId": { "type": "keyword" }, ...

while beginning from Hibernate Search 5.11.0, index definition is as follows:

1 2 3 4 5 6 7 8 9 10 11 12 ... "properties": { "__HSearch_TenantId": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }, ...

The query executed by Hibernate Search looks like this

1 2 3 4 5 6 7 8 ... "filter": [ { "term": { "__HSearch_TenantId": "foo-bar" } }, ...

and will never return any result.

In our opinion, either the index definition of field __HSearch_TenantId has to be reverted to the original behaviour, or the generated filter query by the FullTextEntityManager should use the keyword field.

Environment

Elasticsearch 6.3.1
Hibernate 5.4.1
Hibernate Search 5.11.x

Status

Assignee

Yoann Rodière

Reporter

Mirko Adebahr

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Affects versions

5.11.0.Final
5.11.1.Final

Priority

Critical