@IndexedEmbedded and @AnalyzerDef hibernate Search specific annotation creating problem while integrating with elastic search .
Below are the errors
Caused by: org.hibernate.search.exception.SearchException: HSEARCH400020: Could not create mapping for entity type MODEL
Suppressed: org.hibernate.search.exception.SearchException: HSEARCH400007: Elasticsearch request failed.
Request: PUT /MODEL_NAME with parameters {}
Response: 400 ‘Bad Request’ with body
{
“error”: {
“root_cause”: [
{
“type”: “parse_exception”,
“reason”: “unknown key [analysis] for create index”
}
],
“type”: “parse_exception”,
“reason”: “unknown key [analysis] for create index”
},
“status”: 400
}
And I can seen It tried for other entities created in elastic index but always yellow
Hibernate Search 5.11 is compatible with Elasticsearch 5.6 at most.
For Elasticsearch 6 or 7, you should use Hibernate Search 6. The API is different, but more adapted to Elasticsearch. It’s in beta, but it’s well tested and nearing the candidate release phase.
@yrodiere thanks for the information
But we can not move with Beta version.
Can u please suggest how can we cluster the index of hibernate search without elastic.
Thanks in advance
Well you can also move to Elasticsearch 5.6, then it should work. It’s an old version, but then so is Hibernate Search 5.11
As to clustering without Elasticsearch… there are solutions using JGroups/JMS and replication over NFS shares. But that will likely be quite complex to set up, documentation is not very extensive, and I won’t be able to help you since I’ve never used it. Also, we’re removing support for these configurations in Hibernate Search 6, so it’s not exactly future proof.
OK so we decide to upgrade to HS 6.
following this article Hibernate Search 6.0.11.Final: Reference Documentation
Unfortunately we landed in error
An attempt was made to call the method org.elasticsearch.client.RestClient.performRequestAsync(Lorg/elasticsearch/client/Request;Lorg/elasticsearch/client/ResponseListener;)Lorg/elasticsearch/client/Cancellable; but it does not exist. Its class, org.elasticsearch.client.RestClient, is available from the following locations:
jar:file:/C:/Users/EXN801/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/6.4.2/elasticsearch-rest-client-6.4.2.jar!/org/elasticsearch/client/RestClient.class
It was loaded from the following location:
file:/C:/Users/EXN801/.m2/repository/org/elasticsearch/client/elasticsearch-rest-client/6.4.2/elasticsearch-rest-client-6.4.2.jar
Requesting assistance in this regards as this is new to me and I am totally confused if I have to explicitly add the elastic search jars in application or not
You have a dependency to elasticsearch-rest-client
in your project, and the version of your dependency doesn’t match the one expected by Hibernate Search.
Use the same version as Hibernate Search and everything should work; in 6.0.0.Beta10
, you should use elasticsearch-rest-client
version 7.9.0
.
Note that you can perfectly use a new version of elasticsearch-rest-client
(e.g. 7.9.0
) to “talk” with an old version of Elasticsearch (e.g. 6.4.2
). So the upgrade should be safe.
EDIT: Also, before going any further, double-check you didn’t leave any dependency to Hibernate Search 5… things will definitely not work well if you have both Hibernate Search 5 and Hibernate Search 6 in your classpath.
I removed all the dependencies for HS 5
for elastic search I didn’t specified any version and default download was 6.4 then I tried with other version still It was picking 6.4 so trying removing it completely and test if it works with the version you specified.
Thanks
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.0.RELEASE</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring-boot}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>7.9.0</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm</artifactId>
<version>6.0.0.Beta10</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
<version>6.0.0.Beta10</version>
</dependency>
<!-- <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.11.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-elasticsearch</artifactId>
<version>5.11.0.Final</version>
</dependency>-->
<!-- https://mvnrepository.com/artifact/org.elasticsearch.client/elasticsearch-rest-high-level-client
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>7.5.1</version>
</dependency>-->
Here are all the dependencies still its downloading the 6.4
Well if that’s all you defined, I’d say Spring Boot probably has dependency management rules that force the version down to 6.4. Look at the parent pom, there’s probably a property you need to override.
EDIT: Yep:
<elasticsearch.version>6.4.2</elasticsearch.version>
From https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.1.0.RELEASE/pom
Now landed to this error
Description:
An attempt was made to call the method org.hibernate.metamodel.spi.MetamodelImplementor.entity(Ljava/lang/String;)Lorg/hibernate/metamodel/model/domain/spi/EntityTypeDescriptor; but it does not exist. Its class, org.hibernate.metamodel.spi.MetamodelImplementor, is available from the following locations:
jar:file:/C:/Users/EXN801/.m2/repository/org/hibernate/hibernate-core/5.3.6.Final/hibernate-core-5.3.6.Final.jar!/org/hibernate/metamodel/spi/MetamodelImplementor.class
It was loaded from the following location:
file:/C:/Users/EXN801/.m2/repository/org/hibernate/hibernate-core/5.3.6.Final/hibernate-core-5.3.6.Final.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.hibernate.metamodel.spi.MetamodelImplementor
got it ! we have to upgrade the hibernate to <hibernate.version>5.4.7.Final</hibernate.version>[
Indeed. You can find the required version of the main dependencies on our website or in the documentation (Elasticsearch versions aren’t mentioned there yet, but they will be soon).