hibernate search for elasticsearch with JPA can not auto create index when jpa create an entity
In order for Hibernate Search to plug into Hibernate ORM, and to index an entity when it's persisted, you also need to add the org.hibernate:hibernate-search-orm
module as a dependency of your project:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-search-orm</artifactId> <version>5.6.0.Final</version></dependency>
Maybe this dependency is missing?
When enabling the Elasticsearch indexmanager using this property:
<property name="hibernate.search.default.indexmanager" value="elasticsearch"/>
this will get the indexes created on Elasticsearch, instead of the local Lucene index.
Essentially these other options are being ignored:
<property name="hibernate.search.default.directory_provider" value="filesystem"/><property name="hibernate.search.default.indexBase" value="/Users/yybbk/index"/>
Hibernate Search should have automatically created the indexes on Elasticsearch.You should be able to check that using your browser pointing at http://localhost:9200/group/?pretty (where "group" is the index name, I copied that from your @Indexed annotation).