Skip to content

Commit

Permalink
Add GET api/v1/indexes to Lambda searcher (#5069)
Browse files Browse the repository at this point in the history
* feat: add GET api/v1/indexes to Lambda searcher

* chore: add GET api/v1/indexes endpoint E2E test for CDK Deployment
  • Loading branch information
tyrwzl committed Jun 4, 2024
1 parent ec5f8e7 commit 63f198b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions distribution/lambda/cdk/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,4 @@ def req(method, path, body=None, expected_status=200):
expected_status=400,
)
req("GET", f"/api/v1/_elastic/_search?q=animal", expected_status=501)
req("GET", f"/api/v1/indexes/{mock_sales_index_id}")
12 changes: 11 additions & 1 deletion quickwit/quickwit-lambda/src/searcher/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,22 @@ fn es_compat_api(
.or(es_compat_cat_indices_handler(metastore.clone()))
}

fn index_api(
metastore: MetastoreServiceClient,
) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone {
get_index_metadata_handler(metastore)
}

fn v1_searcher_api(
search_service: Arc<dyn SearchService>,
metastore: MetastoreServiceClient,
) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone {
warp::path!("api" / "v1" / ..)
.and(native_api(search_service.clone()).or(es_compat_api(search_service, metastore)))
.and(
native_api(search_service.clone())
.or(es_compat_api(search_service, metastore.clone()))
.or(index_api(metastore)),
)
.with(warp::filters::compression::gzip())
.recover(|rejection| {
error!(?rejection, "request rejected");
Expand Down
3 changes: 2 additions & 1 deletion quickwit/quickwit-serve/src/index_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
mod rest_handler;

pub use self::rest_handler::{
index_management_handlers, IndexApi, IndexUpdates, ListSplitsQueryParams, ListSplitsResponse,
get_index_metadata_handler, index_management_handlers, IndexApi, IndexUpdates,
ListSplitsQueryParams, ListSplitsResponse,
};
2 changes: 1 addition & 1 deletion quickwit/quickwit-serve/src/index_api/rest_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn json_body<T: DeserializeOwned + Send>(
warp::body::content_length_limit(1024 * 1024).and(warp::body::json())
}

fn get_index_metadata_handler(
pub fn get_index_metadata_handler(
metastore: MetastoreServiceClient,
) -> impl Filter<Extract = (impl warp::Reply,), Error = Rejection> + Clone {
warp::path!("indexes" / String)
Expand Down
1 change: 1 addition & 0 deletions quickwit/quickwit-serve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ pub mod lambda_search_api {
es_compat_index_stats_handler, es_compat_scroll_handler, es_compat_search_handler,
es_compat_stats_handler,
};
pub use crate::index_api::get_index_metadata_handler;
pub use crate::rest::recover_fn;
pub use crate::search_api::{search_get_handler, search_post_handler};
}
Expand Down

0 comments on commit 63f198b

Please sign in to comment.