use std::borrow::Cow;
use serde::{Serialize, Deserialize};
use crate::util::StrJoin;
#[macro_use]
pub mod common;
pub mod analyze;
pub mod bulk;
pub mod delete;
pub mod delete_index;
pub mod get;
pub mod index;
pub mod mapping;
pub mod refresh;
pub mod search;
pub mod version;
fn format_multi<'a>(parts: &[&'a str]) -> Cow<'a, str> {
match parts.len() {
0 => Cow::Borrowed("_all"),
1 => Cow::Borrowed(parts[0]),
_ => Cow::Owned(parts.iter().join(",")),
}
}
fn format_indexes_and_types<'a>(indexes: &[&'a str], types: &[&str]) -> Cow<'a, str> {
if types.is_empty() {
format_multi(indexes)
} else {
Cow::Owned(format!("{}/{}", format_multi(indexes), format_multi(types)))
}
}
#[derive(Debug, Deserialize, Serialize)]
pub struct ShardCountResult {
pub total: u64,
pub successful: u64,
pub failed: u64,
}
#[derive(Debug, Deserialize)]
pub struct GenericResult {
pub acknowledged: bool,
}