-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GET api/v1/indexes to Lambda searcher #5069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution and for testing it on Grafana! It's amazing to see it works!
Nit: have you tried running the CDK examples already? If so, you could add this new endpoint to the tests here
quickwit/distribution/lambda/cdk/cli.py
Lines 420 to 462 in f8590d5
def test_mock_data_endpoints(): | |
apigw_url = _get_cloudformation_output_value( | |
app.MOCK_DATA_STACK_NAME, mock_data_stack.API_GATEWAY_EXPORT_NAME | |
) | |
def req(method, path, body=None, expected_status=200): | |
conn = http.client.HTTPSConnection(urlparse(apigw_url).netloc) | |
conn.request( | |
method, | |
path, | |
body, | |
headers={"x-api-key": os.getenv("SEARCHER_API_KEY")}, | |
) | |
response = conn.getresponse() | |
print(f"{method} {path}") | |
headers = {k: v for (k, v) in response.getheaders()} | |
body = _decompress_if_gzip(response.read(), headers) | |
if response.status != expected_status: | |
print(f"[{response.status}] => {body}") | |
exit(1) | |
else: | |
print(f"[{response.status}] => {json.dumps(json.loads(body))[0:100]}") | |
req("GET", f"/api/v1/{mock_sales_index_id}/search?query=animal") | |
req( | |
"POST", | |
f"/api/v1/{mock_sales_index_id}/search", | |
'{"query":"quantity:>5", "max_hits": 10}', | |
) | |
req("GET", f"/api/v1/_elastic/{mock_sales_index_id}/_search?q=animal") | |
req( | |
"POST", | |
f"/api/v1/_elastic/{mock_sales_index_id}/_search", | |
'{"query":{"bool":{"must":[{"range":{"quantity":{"gt":5}}}]}},"size":10}', | |
) | |
req("GET", f"/api/v1/_elastic/{mock_sales_index_id}/_field_caps?fields=quantity") | |
# expected errors | |
req( | |
"GET", | |
f"/api/v1/_elastic/{mock_sales_index_id}/_search?query=animal", | |
expected_status=400, | |
) | |
req("GET", f"/api/v1/_elastic/_search?q=animal", expected_status=501) |
export CDK_ACCOUNT=123456789
export CDK_REGION=us-east-1
make bootstrap
make deploy-mock-data
make test-mock-data-endpoints
Thank you for instructions.
|
@rdettai |
Description
Closes #5039.
Add
GET /api/v1/indexes
endpoint to Lambda Searcher to use quickwit Lambda as Grafana datasource.How was this PR tested?
http://host.docker.internal:9000/lambda-url/searcher/api/v1
hdfs-logs