fix(elasticsearch): correct totals and CAT JSON output

This commit is contained in:
onenewcode authored and GitHub committed 2026-07-23 17:06:23 +08:00
1 parent a8e5e8d8f9
commit f07509b5ad
27 files changed
+855 -70

No files matched your search

+19 -2
View File
@@ -3,7 +3,7 @@ use std::sync::Arc;
use tauri::State;
use crate::commands::connection::{ensure_connection_writable, AppState};
use dbx_core::db::mongo_driver::MongoDocumentResult;
use dbx_core::db::document_result::DocumentQueryResult;
use dbx_core::document_ops::CollectionInfo;
pub(crate) async fn run_cancellable<T, F>(
@@ -58,7 +58,7 @@ pub async fn document_find_documents(
projection: Option<String>,
sort: Option<String>,
execution_id: Option<String>,
) -> Result<MongoDocumentResult, String> {
) -> Result<DocumentQueryResult, String> {
let app = state.inner().clone();
run_cancellable(
&app,
@@ -78,6 +78,23 @@ pub async fn document_find_documents(
.await
}
#[tauri::command]
pub async fn elasticsearch_count_documents(
state: State<'_, Arc<AppState>>,
connection_id: String,
index: String,
filter: Option<String>,
execution_id: Option<String>,
) -> Result<u64, String> {
let app = state.inner().clone();
run_cancellable(
&app,
execution_id,
dbx_core::document_ops::count_elasticsearch_documents_core(&app, &connection_id, &index, filter.as_deref()),
)
.await
}
#[tauri::command]
pub async fn document_insert_document(
state: State<'_, Arc<AppState>>,