Open junqiu-lei opened 1 year ago
@IanHoang I tested the opensearch-py client with a simple python script and found out that this is an issue with OSB only, as the below script ran successfully
from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth
import boto3
host = '<DOMAIN-NAME>' # cluster endpoint, for example: my-test-domain.us-east-1.es.amazonaws.com
region = 'us-east-1'
service = 'es' # 'aoss' for OpenSearch Serverless
credentials = boto3.Session().get_credentials()
auth = AWSV4SignerAuth(credentials, region, service)
client = OpenSearch(
hosts = [{'host': host, 'port': 443}],
http_auth = auth,
use_ssl = True,
verify_certs = True,
connection_class = RequestsHttpConnection,
pool_maxsize = 20
)
print(client.info())
index_name = 'test-index'
print("Creating index")
print(client.indices.create(index_name))
q = 'miller'
query = {
'size': 5,
'query': {
'multi_match': {
'query': q,
'fields': ['title^2', 'director']
}
}
}
response = client.transport.perform_request("GET", f"/{index_name}/_search", body=query)
# response = client.search(
# body = query,
# index = index_name
# )
print('\nSearch results:')
print(response)
print("Deleting Index")
print(client.indices.delete(index_name))
Describe the bug I am using the OSB 1.1.0 to run Amazon OpenSearch benchmarks, it can create, ingest index, but got error at the query step.
I found the search api call in OSB is using GET method, but in the documentation https://docs.aws.amazon.com/opensearch-service/latest/developerguide/searching.html#searching-dsl, it says:
Similar issue: https://stackoverflow.com/questions/69869225/why-do-i-get-the-request-signature-we-calculated-does-not-match-the-signature-y/69913289#69913289
So I am wondering if we need update search call with POST method?
To Reproduce
Expected behavior No query error
Logs
More Context (please complete the following information):
Additional context Add any other context about the problem here.