From bda06f04002b2823375285c6692f9107d4163737 Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Thu, 2 Nov 2023 17:15:30 +0900 Subject: [PATCH] Added a --v2 hidden in the ingest client. --- quickwit/quickwit-cli/src/index.rs | 10 ++++++++++ quickwit/quickwit-rest-client/src/rest_client.rs | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/quickwit/quickwit-cli/src/index.rs b/quickwit/quickwit-cli/src/index.rs index ce07f236224..88a06d887c1 100644 --- a/quickwit/quickwit-cli/src/index.rs +++ b/quickwit/quickwit-cli/src/index.rs @@ -130,6 +130,12 @@ pub fn build_index_command() -> Command { .short('w') .help("Wait for all documents to be commited and available for search before exiting") .action(ArgAction::SetTrue), + // TODO remove me after Quickwit 0.7. + Arg::new("v2") + .long("v2") + .help("Ingest v2 (experimental! Do not use me.)") + .hide(true) + .action(ArgAction::SetTrue), Arg::new("force") .long("force") .short('f') @@ -207,6 +213,7 @@ pub struct IngestDocsArgs { pub input_path_opt: Option, pub batch_size_limit_opt: Option, pub commit_type: CommitType, + pub ingest_v2: bool, } #[derive(Debug, Eq, PartialEq)] @@ -323,6 +330,7 @@ impl IndexCliCommand { let index_id = matches .remove_one::("index") .expect("`index` should be a required arg."); + let ingest_v2 = matches.get_flag("v2"); let input_path_opt = if let Some(input_path) = matches.remove_one::("input-path") { Uri::from_str(&input_path)? .filepath() @@ -352,6 +360,7 @@ impl IndexCliCommand { input_path_opt, batch_size_limit_opt, commit_type, + ingest_v2, })) } @@ -812,6 +821,7 @@ pub async fn ingest_docs_cli(args: IngestDocsArgs) -> anyhow::Result<()> { batch_size_limit_opt, Some(&update_progress_bar), args.commit_type, + args.ingest_v2, ) .await?; progress_bar.finish(); diff --git a/quickwit/quickwit-rest-client/src/rest_client.rs b/quickwit/quickwit-rest-client/src/rest_client.rs index 3125c318702..1b18a8a6959 100644 --- a/quickwit/quickwit-rest-client/src/rest_client.rs +++ b/quickwit/quickwit-rest-client/src/rest_client.rs @@ -257,8 +257,13 @@ impl QuickwitClient { batch_size_limit_opt: Option, on_ingest_event: Option<&(dyn Fn(IngestEvent) + Sync)>, last_block_commit: CommitType, + ingest_v2: bool, ) -> Result<(), Error> { - let ingest_path = format!("{index_id}/ingest"); + let ingest_path = if ingest_v2 { + format!("{index_id}/ingest-v2") + } else { + format!("{index_id}/ingest") + }; let batch_size_limit = batch_size_limit_opt.unwrap_or(INGEST_CONTENT_LENGTH_LIMIT); let mut batch_reader = match ingest_source { IngestSource::File(filepath) => {