I'm porting the following code to take advantage of the Elasticsearch backend and the Lucene query translation:
The migrated version looks like:
This causes NPE when the index manager is not elasticsearch since the LuceneQueryDescriptor does not use the list of indexed classes:
Thank you for this report!
ExtendedSearchIntegrator is part of an implementation package and as such, should not be accessed by user nor service-provider code. Your snippet of code is, in theory, unsupported, since it's making use of ExtendedSearchIntegrator.
If you want to execute this query, you should take advantage of org.hibernate.search.FullTextSession.createFullTextQuery(QueryDescriptor, Class<?>...). You'll have to provide the targeted entities once again, though.
This should incidentally solve the NPE issue. Can you please confirm this?
Now, I agree there still is an issue somewhere, but I think it's more of an API problem here. I have created HSEARCH-2369, and to address those issues.
Hello , unfortunately the FulltextSession is not involved since I am not using ORM, but Integrating Infinispan with Hibernate Search  , and that integration essentially creates a query from the SearchFactory. So my PR is just a workaround, but ideally an API should be in place in order to migrate
so that it works both with a Elasticsearch and plain Directory backends, with the lucene query translation working.