[JIRA] (HSEARCH-4867) Support AWS OpenSearch Serverless
by Rokko11 (JIRA)
Rokko11 ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=712020%... ) *commented* on HSEARCH-4867 ( https://hibernate.atlassian.net/browse/HSEARCH-4867?atlOrigin=eyJpIjoiNDA... )
Re: Support AWS OpenSearch Serverless ( https://hibernate.atlassian.net/browse/HSEARCH-4867?atlOrigin=eyJpIjoiNDA... )
Using this small reproducer: https://github.com/Mozenn/spring-boot-hibernate-search
Spring configuration is
logging:
level:
org:
hibernate:
search:
backend:
elasticsearch: TRACE
spring:
jpa:
open-in-view: false
properties:
hibernate:
search:
backend:
aws:
region: <region>
signing:
enabled: true
discovery:
enabled: false
hosts: <collection>.<region>.aoss.amazonaws.com
protocol: https
type: elasticsearch
version: opensearch:2.5
version_check:
enabled: false
schema_management:
strategy: create-or-validate
Credentials are stored in environment variables.
The full trace log is. You see that the service key was inserted correctly.
2023-06-06 15:44:07.706 INFO 23196 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-06-06 15:44:07.900 DEBUG 23196 --- [ main] o.h.s.b.e.index.layout.impl.IndexNames : Normalizing index name from 'Plant-write' to 'plant-write'
2023-06-06 15:44:07.901 DEBUG 23196 --- [ main] o.h.s.b.e.index.layout.impl.IndexNames : Normalizing index name from 'Plant-read' to 'plant-read'
2023-06-06 15:44:07.901 DEBUG 23196 --- [ main] o.h.s.b.e.index.layout.impl.IndexNames : Normalizing index name from 'Plant' to 'plant'
2023-06-06 15:44:08.152 DEBUG 23196 --- [ main] a.i.ElasticsearchAwsHttpClientConfigurer : AWS request signing is enabled [region = '<region>', credentialsProvider = 'DefaultCredentialsProvider(providerChain=LazyAwsCredentialsProvider(delegate=Lazy(value=Uninitialized)))'].
2023-06-06 15:44:11.936 WARN 23196 --- [ main] .h.s.b.e.d.i.ElasticsearchDialectFactory : HSEARCH400085: Unknown Elasticsearch version running on the cluster: 'opensearch:2.5'. Hibernate Search may not work correctly. Consider updating to a newer version of Hibernate Search, if any.
2023-06-06 15:44:12.448 TRACE 23196 --- [ main] h.s.b.e.a.i.AwsSigningRequestInterceptor : HTTP request (before signing): GET /plant-write,plant-read?ignore_unavailable=true&allow_no_indices=true HTTP/1.1 [Content-Length: 0, Host: <collection>.<region>.aoss.amazonaws.com:443, Connection: Keep-Alive, User-Agent: elasticsearch-java/7.15.2-SNAPSHOT (Java/17.0.7)]
2023-06-06 15:44:12.449 TRACE 23196 --- [ main] h.s.b.e.a.i.AwsSigningRequestInterceptor : AWS request (before signing): DefaultSdkHttpFullRequest(httpMethod=GET, protocol=https, host=<collection>.<region>.aoss.amazonaws.com, port=443, encodedPath=/plant-write,plant-read, headers=[], queryParameters=[ignore_unavailable, allow_no_indices])
2023-06-06 15:44:12.662 TRACE 23196 --- [ main] h.s.b.e.a.i.AwsSigningRequestInterceptor : AWS credentials: AwsCredentials(accessKeyId=<access-key>)
2023-06-06 15:44:19.456 TRACE 23196 --- [ main] h.s.b.e.a.i.AwsSigningRequestInterceptor : AWS request (after signing): DefaultSdkHttpFullRequest(httpMethod=GET, protocol=https, host=<collection>.<region>.aoss.amazonaws.com, port=443, encodedPath=/plant-write,plant-read, headers=[Authorization, Host, X-Amz-Date], queryParameters=[ignore_unavailable, allow_no_indices])
2023-06-06 15:44:19.457 TRACE 23196 --- [ main] h.s.b.e.a.i.AwsSigningRequestInterceptor : HTTP request (after signing): GET /plant-write,plant-read?ignore_unavailable=true&allow_no_indices=true HTTP/1.1 [Content-Length: 0, Host: <collection>.<region>.aoss.amazonaws.com, Connection: Keep-Alive, User-Agent: elasticsearch-java/7.15.2-SNAPSHOT (Java/17.0.7), Authorization: AWS4-HMAC-SHA256 Credential=<access-key>/20230606/<region>/aoss/aws4_request, SignedHeaders=host;x-amz-date, Signature=c1dd3543...2bd784218, X-Amz-Date: 20230606T134419Z]
2023-06-06 15:44:20.470 DEBUG 23196 --- [port thread - 1] o.h.s.b.e.index.layout.impl.IndexNames : Normalizing index name from 'Plant-000001' to 'plant-000001'
2023-06-06 15:44:20.511 TRACE 23196 --- [port thread - 1] h.s.b.e.a.i.AwsSigningRequestInterceptor : HTTP request (before signing): PUT /plant-000001 HTTP/1.1 [Content-Length: 496, Content-Type: application/json; charset=UTF-8, Host: <collection>.<region>.aoss.amazonaws.com:443, Connection: Keep-Alive, User-Agent: elasticsearch-java/7.15.2-SNAPSHOT (Java/17.0.7)]
2023-06-06 15:44:20.512 TRACE 23196 --- [port thread - 1] h.s.b.e.a.i.AwsSigningRequestInterceptor : AWS request (before signing): DefaultSdkHttpFullRequest(httpMethod=PUT, protocol=https, host=<collection>.<region>.aoss.amazonaws.com, port=443, encodedPath=/plant-000001, headers=[], queryParameters=[])
2023-06-06 15:44:20.512 TRACE 23196 --- [port thread - 1] h.s.b.e.a.i.AwsSigningRequestInterceptor : AWS credentials: AwsCredentials(accessKeyId=<access-key>)
2023-06-06 15:44:23.804 TRACE 23196 --- [port thread - 1] h.s.b.e.a.i.AwsSigningRequestInterceptor : AWS request (after signing): DefaultSdkHttpFullRequest(httpMethod=PUT, protocol=https, host=<collection>.<region>.aoss.amazonaws.com, port=443, encodedPath=/plant-000001, headers=[Authorization, Host, X-Amz-Date], queryParameters=[])
2023-06-06 15:44:23.805 TRACE 23196 --- [port thread - 1] h.s.b.e.a.i.AwsSigningRequestInterceptor : HTTP request (after signing): PUT /plant-000001 HTTP/1.1 [Content-Length: 496, Content-Type: application/json; charset=UTF-8, Host: <collection>.<region>.aoss.amazonaws.com, Connection: Keep-Alive, User-Agent: elasticsearch-java/7.15.2-SNAPSHOT (Java/17.0.7), Authorization: AWS4-HMAC-SHA256 Credential=<access-key>/20230606/<region>/aoss/aws4_request, SignedHeaders=host;x-amz-date, Signature=cc0b142...282453616231d9d, X-Amz-Date: 20230606T134423Z]
2023-06-06 15:44:23.910 ERROR 23196 --- [port thread - 1] o.h.s.e.r.spi.RootFailureCollector : HSEARCH000521: Hibernate Search encountered a failure during bootstrap; continuing for now to list all problems, but the process will ultimately be aborted.
Context: Hibernate ORM mapping, type 'com.mozen.springboothibernatesearch.model.Plant'
Failure:
org.hibernate.search.util.common.SearchException: HSEARCH400007: Elasticsearch request failed: HSEARCH400090: Elasticsearch response indicates a failure.
Request: PUT /plant-000001 with parameters {}
Response: 403 'Forbidden' from 'https://<collection>.<region>.aoss.amazonaws.com' with body
{
"status": 403,
"request-id": "6ec4d116-6532-9bd2-8344-5cf07260d987",
"error": {
"reason": "Invalid signature, does not match",
"type": "AccessDenied"
}
}
( https://hibernate.atlassian.net/browse/HSEARCH-4867#add-comment?atlOrigin... ) Add Comment ( https://hibernate.atlassian.net/browse/HSEARCH-4867#add-comment?atlOrigin... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:3b7cdab )
2 years, 10 months
[JIRA] (HHH-16757) parameters from pageable are not correctly propagated to the final query after migration from Hibernate 5.3.x to 6.0.0
by Krzysztof T (JIRA)
Krzysztof T ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNjM3ZDQyYWUz... ) / Bug ( https://hibernate.atlassian.net/browse/HHH-16757?atlOrigin=eyJpIjoiNjM3ZD... ) HHH-16757 ( https://hibernate.atlassian.net/browse/HHH-16757?atlOrigin=eyJpIjoiNjM3ZD... ) parameters from pageable are not correctly propagated to the final query after migration from Hibernate 5.3.x to 6.0.0 ( https://hibernate.atlassian.net/browse/HHH-16757?atlOrigin=eyJpIjoiNjM3ZD... )
Issue Type: Bug Affects Versions: 6.0.2 Assignee: Unassigned Components: query-criteria Created: 06/Jun/2023 05:40 AM Environment: JVM: JDK 11/17 (Amazon Correto)
PostgresDB: 9.6.6
Spring Boot 2.7 / 3.0
OS: MacOs Priority: Critical Reporter: Krzysztof T ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%... )
Hello!
After the migration from Spring Boot *2.7.10* to Spring Boot *3.0.5* and from Hibernate *5.6.0.Final* to Hibernate *6.2.2 Final*
The query form Spring-data-jpa for PostgreSQL is generated differently (please see link to repo with branches + examples)
I am using JDK 17 Correto ( *17.07)* , and db is PostgreSQL *9.6.6*
Before migration generated SQL query looks like this:
select exportenti0_.uuid as uuid1_0_, exportenti0_.domain_uuid as domain_u2_0_, exportenti0_.created_by as created_3_0_, exportenti0_.created_date as created_4_0_, exportenti0_.updated_by as updated_5_0_, exportenti0_.updated_date as updated_6_0_, exportenti0_.version as version7_0_, exportenti0_.currency_ex_uuid as currency8_0_, exportenti0_.cutoff_time as cutoff_t9_0_, exportenti0_.data_domain_uid as data_do10_0_, exportenti0_.is_force as is_forc11_0_, exportenti0_.status as status12_0_, exportenti0_.is_use_latest_date as is_use_13_0_ from export exportenti0_ where exportenti0_.domain_uuid=? order by exportenti0_.updated_date desc limit ?
– executes correctly.
After the migration the same query looks like follows:
{{ select e1_0.uuid, e1_0.created_by, e1_0.created_date, e1_0.currency_ex_uuid, e1_0.cutoff_time, e1_0.data_domain_uid, e1_0.domain_uuid, e1_0.is_force, e1_0.status, e1_0.updated_by, e1_0.updated_date, e1_0.is_use_latest_date, e1_0.version from export e1_0 where e1_0.domain_uuid=? order by e1_0.updated_date desc offset ? rows fetch first ? rows only}}
Problem is with line *desc offset ..... rows only* which is added after query translation from java model to SQL at the end.
As you may expected it crashes.
org.postgresql.util.PSQLException: ERROR: syntax error at or near "$3" Position: 328 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713) ~ [postgresql-42.6.0.jar:42.6.0]
I am using the latest driver for postgreSQL, not sure what exactly is causing this issue.
Link to examples with issue:
Repo link ( https://github.com/Krzysztof1985/spring-boot3-jpa )
Thank you in advance!
Regards
Krzysztof
( https://hibernate.atlassian.net/browse/HHH-16757#add-comment?atlOrigin=ey... ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-16757#add-comment?atlOrigin=ey... )
Get Jira notifications on your phone! Download the Jira Cloud app for Android ( https://play.google.com/store/apps/details?id=com.atlassian.android.jira.... ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailN... ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:3b7cdab )
2 years, 10 months