Talent-Catalog / talentcatalog

https://tctalent.org
GNU Affero General Public License v3.0
13 stars 4 forks source link

First attempt (cancelled) to Write new version of Elasticsearch interface #1619

Closed camerojo closed 1 week ago

camerojo commented 2 weeks ago

Spring Boot 3 no longer supports the high level REST interface: RestHighLevelClient - which is what we currently use.

See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#elasticsearch-clients-and-templates

https://chatgpt.com/share/672e9017-9910-800f-8e5f-8e4dcacb7691

Note

This approach attempted to convert the existing running code in Spring Boot 2 over to the new Elasticsearch API. This doesn't seem to be a good way to go.

Instead will rewrite the new Elasticsearch code in the Spring Boot 3 code - so these changes will be delivered directly in #1614

camerojo commented 2 weeks ago

See https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#elasticsearch-clients-and-templates

The options are described here: https://docs.spring.io/spring-boot/docs/3.0.x/reference/html/data.html#data.nosql.elasticsearch

The official low level client is VERY low level - down at HTTP level - working through a generic RestClient bean.

The Java API is fairly straight forward - mapping on to the basic JSON queries

The Spring data version can take JSON string queries directly (it also supports Criteria queries which we don't like, plus a Java query object and builders). It is built on top of the JavaAPI client - which in turn is built on top of the low level REST client.

@ajt001 Started work on the Java API.

Moving to the new Spring Data client is probably the fastest way to convert - see the conversion notes below. We still have access to the JavaAPI so we get the best of both worlds.

Spring guide to converting to new Spring Data Elasticsearch version

https://docs.spring.io/spring-data/elasticsearch/reference/migration-guides/migration-guide-4.4-5.0.html

https://howtodoinjava.com/spring-data/elasticsearch-with-spring-boot-data/

camerojo commented 2 weeks ago