diff --git a/distribution/lambda/Makefile b/distribution/lambda/Makefile index 2a7045d2c87..2b0af195442 100644 --- a/distribution/lambda/Makefile +++ b/distribution/lambda/Makefile @@ -19,9 +19,9 @@ init: check-env build: ../../quickwit/target/lambda/indexer/hdfs-logs-multitenants-10000.json cargo lambda build --manifest-path=../../quickwit/Cargo.toml -p quickwit-lambda --release cp resources/indexer-config.yaml ../../quickwit/target/lambda/indexer/config.yaml - cp resources/querier-config.yaml ../../quickwit/target/lambda/querier/config.yaml + cp resources/searcher-config.yaml ../../quickwit/target/lambda/searcher/config.yaml -deploy: build +deploy: build check-env cdk deploy invoke-indexer: check-env @@ -30,10 +30,10 @@ invoke-indexer: check-env echo "indexer function name: $$function_name" aws lambda invoke --function-name $$function_name --log-type Tail /dev/null | jq -r '.LogResult' | base64 -d -invoke-querier: check-env +invoke-searcher: check-env export AWS_REGION=$$CDK_REGION - function_name=$$(aws cloudformation describe-stacks --stack-name LambdaStack --query "Stacks[0].Outputs[?ExportName=='querier-function-name'].OutputValue" --output text) - echo "querier function name: $$function_name" + function_name=$$(aws cloudformation describe-stacks --stack-name LambdaStack --query "Stacks[0].Outputs[?ExportName=='searcher-function-name'].OutputValue" --output text) + echo "searcher function name: $$function_name" aws lambda invoke --function-name $$function_name --log-type Tail /dev/null | jq -r '.LogResult' | base64 -d @@ -55,7 +55,3 @@ index-creation-instruction: deploy echo "quickwit run &" echo "\n=> once the server has started, create the index" echo "quickwit index create --index-config hdfs_logs_index_config.yaml" - -## If we wanted to create the index from the Lambda -# cp ../../config/tutorials/hdfs-logs/index-config.yaml \ -# ../../quickwit/target/lambda/quickwit-lambda/hdfs-index-config.yaml diff --git a/distribution/lambda/resources/querier-config.yaml b/distribution/lambda/resources/searcher-config.yaml similarity index 81% rename from distribution/lambda/resources/querier-config.yaml rename to distribution/lambda/resources/searcher-config.yaml index ad297e38022..caed87ed0e9 100644 --- a/distribution/lambda/resources/querier-config.yaml +++ b/distribution/lambda/resources/searcher-config.yaml @@ -1,5 +1,5 @@ version: 0.6 -node_id: lambda-querier +node_id: lambda-searcher metastore_uri: s3://${METASTORE_BUCKET} default_index_root_uri: s3://${INDEX_BUCKET} data_dir: /tmp diff --git a/distribution/lambda/stacks/indexing_service.py b/distribution/lambda/stacks/indexer_service.py similarity index 96% rename from distribution/lambda/stacks/indexing_service.py rename to distribution/lambda/stacks/indexer_service.py index 3e42a2678b8..1a7562fe3d4 100644 --- a/distribution/lambda/stacks/indexing_service.py +++ b/distribution/lambda/stacks/indexer_service.py @@ -2,7 +2,7 @@ from aws_cdk import aws_lambda, aws_s3, Duration, CfnOutput -class IndexingService(Construct): +class IndexerService(Construct): def __init__( self, scope: Construct, construct_id: str, store_bucket: aws_s3.Bucket, **kwargs ) -> None: diff --git a/distribution/lambda/stacks/lambda_stack.py b/distribution/lambda/stacks/lambda_stack.py index 6619b3b3879..263f2f1a373 100644 --- a/distribution/lambda/stacks/lambda_stack.py +++ b/distribution/lambda/stacks/lambda_stack.py @@ -1,7 +1,7 @@ from aws_cdk import Stack, aws_s3, CfnOutput from constructs import Construct -from . import indexing_service, query_service +from . import indexer_service, searcher_service class LambdaStack(Stack): @@ -9,8 +9,8 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None: super().__init__(scope, construct_id, **kwargs) bucket = aws_s3.Bucket(self, "index-store") - indexing_service.IndexingService(self, "IndexingService", store_bucket=bucket) - query_service.QueryService(self, "QueryService", store_bucket=bucket) + indexer_service.IndexerService(self, "IndexerService", store_bucket=bucket) + searcher_service.SearcherService(self, "SearcherService", store_bucket=bucket) CfnOutput( self, diff --git a/distribution/lambda/stacks/query_service.py b/distribution/lambda/stacks/searcher_service.py similarity index 82% rename from distribution/lambda/stacks/query_service.py rename to distribution/lambda/stacks/searcher_service.py index 53e779818e6..1077d05d882 100644 --- a/distribution/lambda/stacks/query_service.py +++ b/distribution/lambda/stacks/searcher_service.py @@ -2,7 +2,7 @@ from aws_cdk import aws_lambda, aws_s3, Duration, CfnOutput -class QueryService(Construct): +class SearcherService(Construct): def __init__( self, scope: Construct, construct_id: str, store_bucket: aws_s3.Bucket, **kwargs ) -> None: @@ -10,8 +10,8 @@ def __init__( handler = aws_lambda.Function( self, - id="quickwit-querier", - code=aws_lambda.Code.from_asset("../../quickwit/target/lambda/querier"), + id="quickwit-searcher", + code=aws_lambda.Code.from_asset("../../quickwit/target/lambda/searcher"), runtime=aws_lambda.Runtime.PROVIDED_AL2, handler="N/A", environment={ @@ -25,7 +25,7 @@ def __init__( CfnOutput( self, - "querier-function-name", + "searcher-function-name", value=handler.function_name, - export_name="querier-function-name", + export_name="searcher-function-name", ) diff --git a/quickwit/quickwit-lambda/Cargo.toml b/quickwit/quickwit-lambda/Cargo.toml index ca5bfaa4997..46b81f7e8fe 100644 --- a/quickwit/quickwit-lambda/Cargo.toml +++ b/quickwit/quickwit-lambda/Cargo.toml @@ -14,8 +14,8 @@ name = "indexer" path = "src/indexer.rs" [[bin]] -name = "querier" -path = "src/querier.rs" +name = "searcher" +path = "src/searcher.rs" [dependencies] anyhow = { workspace = true } diff --git a/quickwit/quickwit-lambda/src/lib.rs b/quickwit/quickwit-lambda/src/lib.rs index 05bf98ead6e..8f634149765 100644 --- a/quickwit/quickwit-lambda/src/lib.rs +++ b/quickwit/quickwit-lambda/src/lib.rs @@ -47,7 +47,7 @@ pub async fn index_handler(_event: LambdaEvent) -> Result { })) } -pub async fn query_handler(_event: LambdaEvent) -> Result { +pub async fn search_handler(_event: LambdaEvent) -> Result { let ingest_res = local_search_cli(LocalSearchArgs { config_uri: Uri::from_well_formed("file:///var/task/config.yaml"), index_id: String::from("hdfs-logs"), diff --git a/quickwit/quickwit-lambda/src/querier.rs b/quickwit/quickwit-lambda/src/searcher.rs similarity index 92% rename from quickwit/quickwit-lambda/src/querier.rs rename to quickwit/quickwit-lambda/src/searcher.rs index a676108b48a..8cd548dd73b 100644 --- a/quickwit/quickwit-lambda/src/querier.rs +++ b/quickwit/quickwit-lambda/src/searcher.rs @@ -18,11 +18,11 @@ // along with this program. If not, see . use lambda_runtime::service_fn; -use quickwit_lambda::query_handler; +use quickwit_lambda::search_handler; #[tokio::main] async fn main() -> anyhow::Result<()> { - let func = service_fn(query_handler); + let func = service_fn(search_handler); lambda_runtime::run(func) .await .map_err(|e| anyhow::anyhow!(e))